I have two tables are data and report.
The data table contains two columns: item and text. The item and text columns contain duplicates.
I am applying the following calculated column in the report table
RESULT =
CALCULATE (
FIRSTNONBLANK ( DATA[TEXT], TRUE () ),
FILTER ( DATA, DATA[ITEM] = REPORT[ITEM] )
)
In order to get the data from the data table into the report table.
If the item is not available in the data table, then return “NA” according to the item in the report table. My calculated column is showing blanks if the item is not available in the data table but I want "NA" instead of blanks.
My calculated column is picking the min qty according to the item in the report table based on the data table where the same item contains multiple qty but I want max qty in the report table according to the item where the same item contains multiple qty.
Can you please advise?
Herewith attached the power bi for your reference.
https://www.dropbox.com/s/e3fa45f8qz8a2tm/LOOKUP%20MULTIPLE%20VALUE_QTY.pbix?dl=0
Data & Report:
You can get the max with just
RESULT = CALCULATE ( MAX ( DATA[TEXT] ) )
Replacing blanks with NA is possible but it means the RESULT column must be converted to a text data type (since a column cannot have multiple data types).
I don't advise doing that, but you can like this:
RESULT =
VAR MaxText = CALCULATE ( MAX ( DATA[TEXT] ) )
RETURN
IF ( ISBLANK ( MaxText ), "NA", FORMAT ( MaxText, "0" ) )
Related
I have country column, where multiple values can appear in a cell.
Example, for row of column "Approved By", data appears in following way (data in a cell):
Is there a way in which I can take distinct values from this column and show it as a list using slicer,
in this case if I select "India" as a the value in the slicer all rows where India appears as a country should come up in the grid.
Assuming you have a separate table (named Countries) which comprises a single-column (named Country) of unique country names, create the following measure:
MyFilter =
VAR SelectedCountry =
MIN( Countries[Country] )
VAR ApprovedBy =
MIN( 'Table'[Approved By] )
RETURN
IF( SEARCH( SelectedCountry, ApprovedBy,, 0 ), 1 )
You can now add MyFilter to the Filters Pane and set it equal to 1.
I'm trying to group table by the id column and then display the values of another column in a concatenated list. This is the original table:
Original Table
And this is the desired outcome:
Desired Outcome
Is there any way to do this in Power Bi?
You can create a calculated Table using this:
Table2 = SUMMARIZE (
'Table',
'Table'[Column1],
"All", CONCATENATEX ( VALUES ( 'Table'[Column2] ), 'Table'[Column2], "," )
)
I want to show the consolidated data for similar record in separate column in power bi data.
I have a data with two columns and i want the result like below in third & fourth column
3rd column result nothing but comparing unique id in rows, e.g. 1=2 =false, 2=2=true
4th column result nothing but concatenation of Value column for unique record
could you please help to achieve this in power bi - i want to create custom columns for these two result in data table
We can use CalculatedColumn in DAX:
Result =
CALCULATE(
CONCATENATEX (
CALCULATETABLE ( VALUES('Unique'[Value] ) ),
'Unique'[Value],
", ",
'Unique'[Value],
ASC
), ALL('Unique'[Value])
)
And you Validation may be a measure:
Valid = if(SELECTEDVALUE('Unique'[Value]) = CALCULATE( max('Unique'[Value]), ALL('Unique'[Value])), FALSE(), TRUE())
I have two tables are Data and Report.
Data Table:
In Data table contain two columns are Item and status.
The item column contains duplicated entry and the item column contains text and number or number only or text only.
The status column contains two different text/comments, "Okay" and "Not Okay"
The report table
In the Report table, I updated both comments/text as "Okay" or "Not Okay".
I would like to create a new calculated column in the report table in order to get the unique count according to the comments based on the data table columns item and status.
In Excel, I am applying the following formula
F2=SUM((FREQUENCY(MATCH(A$2:$A$19&"",$A$1:$A$19&"",0)*($B$2:$B$19=$D3),ROW($A$2:$A$19))>0)+0)-1
in order to get my final result.
I don't want measure solutions.
DATA TABLE:
REPORT TABLE:
EXCEL LOGIC:
This is much easier in DAX than in Excel and there are many ways to do it.
Here are some possibilities with different approaches:
Desired Result =
VAR Comment = REPORT[COMMENTS]
RETURN
CALCULATE (
DISTINCTCOUNT ( DATA[ITEM] ),
DATA[STATUS] = Comment
)
Desired Result =
COUNTROWS (
SUMMARIZE (
FILTER ( DATA, DATA[STATUS] = REPORT[COMMENTS] ),
DATA[ITEM]
)
)
Desired Result =
SUMX (
DISTINCT ( DATA[ITEM] ),
IF ( CALCULATE ( SELECTEDVALUE ( DATA[STATUS] ) ) = REPORT[COMMENTS], 1, 0 )
)
I want to create a table based on input table.
Input table is:
The new table filters the input table to show the last entry of every day.
I have tried working with measure but sometimes cant tell if it is working right until I graph it in pivot tables which is not so bad but sometimes just doesn't show me what I need to see exactly.
I have tried this measure:
History_Daily Efficiency =
VAR LastDailyEfficiency =
GENERATE(
VALUES ('Table_Full'[Cell]),
CALCULATETABLE (
TOPN (
1,
GROUPBY (
'Table_Full',
'Table_Full'[Date],
'Table_Full'[Time],
'Table_Full'[Efficiency]
),
'Table_Full'[Date], DESC,
'Table_Full'[Time], DESC,
'Table_Full'[Efficiency], ASC
)
)
)
RETURN
CALCULATE (
AVERAGE('Table_Full'[Efficiency]),
TREATAS( LastDailyEfficiency, 'Table_Full'[Cell], 'Table_Full'[Date], 'Table_Full'[Time], 'Table_Full'[Efficiency]),
'Table_Full'[Efficiency] < 80
)
But I got this:
I would like to see this as the output:
You can create a new table:
LastDayCount = GROUPBY(Table_Full;Table_Full[lob/Part Number];Table_Full[Date];"LastDate";MAXX(CURRENTGROUP(); Table_Full[DateTime]))
This will create a table with the last DateTime of the day.
Next we add a column giving us the max of that particular last datetime of the day. I noticed that you have more the same entries, the logic below takes the max part count at the end of the day when more than one entry.
Count =
CALCULATE(MAX(Table_Full[Part Count]);
FILTER(Table_Full;LastDayCount[Table_Full_lob/Part Number] = Table_Full[lob/Part Number]
&& LastDayCount[LastDate] = Table_Full[DateTime]))
End result: