SSRS expression to DAX powerbi convertion - reporting-services

IIF(IsNothing(Fields!DivisionOrderType.Value), "",Fields!DivisionOrderType.Value & " " & FormatDateTime(Fields!PrelimDOI.Value, DateFormat.ShortDate))
Need of dax formula in powerbi, is it possible? can anyone help?

can you try like this...
If(Isblank(DivisionOrderType)," ",DivisonOrderType&" "&Format(PrelimDOI,"DD-MM-YYYY"))

I think what you want is this:
IF(ISBLANK(DivisionOrderType), "", DivisionOrderType & " " & FORMAT(PrelimDOI, "yyyy-mm-dd"))
In this example, DivisionOrderType and PrelimDOI are assumed to be column names in the Power BI data model. If these columns have a different name in your data model, you'll need to replace them with the correct column names in the expression.

Related

Access Textbox control source outside current report

I am creating a Report in MS Access 2016. I want textboxes showing a summary of data from other tables - without actually showing rows of those tables (no subreports if possible). For example, I have tried to create a textbox with formula
=Format(Avg([WeekData].[DIFOT]),"##0.0%") & " DIFOT This Week"
which should return something like
100% DIFOT This Week
(NB Weekdata is a query and DIFOT is a field in that query, all in the same database as this report.)
However instead it just gives me #Error.
Please can you tell me the most efficient way to pull together summary figures such as these without creating any more queries and/or subreports than absolutely necessary? I'm quite new to SQL and Access on the whole.
Many thanks in advance.
Use DAvg() domain aggregate function. Also, the ## characters in Format() pattern serve no purpose.
=Format(DAvg("DIFOT", "WeekData"), "0.0%") & " DIFOT This Week"
or
=Format(DAvg("DIFOT", "WeekData"), "Percent") & " DIFOT This Week"

How to concatenate three fields in table into one table?

I would like to concatenate three fields in my MS Access table into one field by using VBA. How can I do this?
I have tried using query to concatenate it and it works, but I would like it to be concatenated and saved in my table instead.
My 3 fields I want to concatenate into 1 field are: CompanyCode,YearCode and PO number.
Currently my table look like this:
Company code YearCode PONumber
ABC 17/ 200
What I want:
PONumber
ABC17/200
Use a query:
Select *, [Company Code] & [YearCode] & [PONumber] As FullNumber
From YourTable
If you insist on having a calculated field in the table itself, use this expression when you - in design view - add the calculated field:
[Company Code] & [YearCode] & [PONumber]
As mentioned #Andre, highly not recommended to use calculated fields in Access tables at all, this feature is quite buggy. But in some cases it's reasonable to store combined code in separate regular field for performance improvement, despite this denormalizes the database structure. You can store combined code in form's BeforeUpdate event:
Me!PONumberFull = Me![Company code] & Me!YearCode & Me!PONumber
Also I'd recommend to do not store "/" in YearCode, just number. In this case the code will be
Me!PONumberFull = Me![Company code] & Me!YearCode & "/" & Me!PONumber

multiple column value to single value with IIF condition in SSRS

Hi Team,
I have a SSRS report like this, the users would like to see the data like the picture below. For Column 2 if the value is N/A the values of column 3 would be in list and separated by comma. and the multiple lines will be converted to only one line where N/A is there.
First you will want to create row groups for two of your columns. I have assumed they're called Shipment and Description. Then you can use Join and LookupSet to do the CSV aggregation. Similar to the answer here.
Something like this:
=Join(LookupSet(Fields!Shipment.Value & "-" & Fields!Description.Value,
Fields!Shipment.Value & "-" & Fields!Description.Value,
Fields!PartNumber.Value, "YourDataset"), ",")

SSRS Reporting Expression to Split Full Name Field

I've been trying to get this to behave with no luck.
The database base field only has FULL NAME field, which includes Middle initials on some cases and no middle initials in some other cases.
I've been trying to display LastName, FirstName by using this ssrs expression below: While this works in names that doesn't have middle initials or name on the field.... for those names that includes middle initials/name, we run into issues with displaying.
=Right(Fields!agent_name.Value,Len(Fields!agent_name.Value)-Instr(Fields!agent_name.Value," ")) & ", " & (Left(Fields!agent_name.Value,Instr(Fields!agent_name.Value," ")))
But it includes the Middle Initials to display first.. As an example:
If the fullname field is John S Doe, above expression displays as:
S Doe, John
What I need to display is:
Doe, John
How do I set my expression to get rid of the Middle initial/name to display?
I've done a great amount of research and tried many diff expressions but no luck.. thanks in advance.
While slightly inefficient, this is a clean way to accomplish the result:
=Split(Fields!agent_name.Value," ")(Split(Fields!agent_name.Value," ").Length-1) + ", " + Split(Fields!agent_name.Value," ")(0)
Edit: The above indeed does not work with suffixes. The expression below will remove a middle initial if its the second name and has a length of 1, which you could use in a calculated field. But it would fail for first name "Ann Marie" and the first/last swap would need to be handled separately.
=IIF(Split(Fields!agent_name.Value," ")(1).Length=1,Replace(Fields!agent_name.Value, " " + Split(Fields!agent_name.Value," ")(1) + " "," "),Fields!agent_name.Value)
The short of it is that you really would be best served handling this in code. But even so, if your fullname field is space-inclusive beyond what you want to seperate on there arises the potential for ambiguous cases, like the suffix- and initial-less "Ann Marie van Der Beek".
Try using this expression:
=RIGHT(
Fields!agent_name.Value,LEN(Fields!agent_name.Value)-InStrRev(Fields!agent_name.Value," "))
& ", " & LEFT(
Fields!agent_name.Value,
InStr(Fields!agent_name.Value," ")-1
)
It is a native SSRS solution however I recommend using custom code to get an maintainable solution.
UPDATE: Regex solution:
=System.Text.RegularExpressions.Regex.Replace(
Fields!agent_name.Value,
"(\w+)\s+(\w+\.*\s)?(\w+)",
"$3, $1"
)
Let me know if this helps.

Concatenate two columns in an Access table

very simple one. I have got two fields in a table called [First Name] and [Last Name]. I would like to add a new column that is just a combination of [First Name] and [Last Name] - is there a way to do this in Access? I know this can be done in Excel using the Concatenate function.
I would like to do this in the existing table and not in a new query.
Thanks!
As #paxty says, do not do this. You have a simple answer in Access that is not available in Excel, and that is a query. You can base any output that requires that the two names be concatenated on a query.
SELECT FirstName & " " & LastName FROM MyTable
In Access 2010 you can create a "calculated field" for your table; Access applies a formula to create the content of the field. You can enter a formula such as:
FirstName & " " & LastName
You could even do fancier things like have an initial then the last name, if there is a last name, or else show the complete first name, using the Access IIf() and Len() functions.
IIf (Len(LastName) > 0, Left(FirstName, 1) & ". " & LastName, FirstName)
By using a calculated field to join the two names directly in the table... It creates issues down the road. I have two fields First & last name I used a calculated field in the table to join the two together. When you try do a report with those calculated names, it will show only the employee number, not the names. Now I am trying to correct my mistake without having to rebuild the multiple tables I have used this field as a look up in.