Forum Discussion
How to write this Condition in Power BI
- 8 years ago
It is working and I am accepting it as a solution however if you could tell me any other simpler way then it would be great as it seems a lot confusing.
Could be that you need to add an ALL or ALLEXCEPT clause or something along those lines. Can you post some sample data and description of where you are seeing the issue?
You know how the world works, I can't share the exact data but sure I will replicate the thing from Northwind Database and share soon.
- iamprajot8 years ago
Responsive Resident
https://1drv.ms/u/s!AmsIJlc64zz0iSGPhQZbprlPgkH_
Here is the link to PBI file.
I have 3 columns COUNTRY, ProductID, STATUS
I want the COUNTRY which is Repeated the Most in First CARD
I want the ProductID which is Repeated the Most and with the STATUS=TRUE (2nd condition) in Second CARD
and both should work correct with the filter/slicer above.
Currrently it is giving wrong results.
- Anonymous8 years agoNot applicable
If you wish to take into account that you might have ties in your data (as in the sample file) you could use the following two measures in your file.
I have tested them and they produce correct result.
Most frequent country =
CONCATENATEX(
CALCULATETABLE(
VALUES(Data[COUNTRY]);
TOPN(1;VALUES(Data[COUNTRY]);CALCULATE(COUNTROWS('Data'));DESC)
);
'Data'[COUNTRY];", "
)Most freq product with status true =
CONCATENATEX(
CALCULATETABLE(
VALUES(Data[PRODUCTID]);
TOPN(1;VALUES(Data[PRODUCTID]);CALCULATE(COUNTROWS('Data'));DESC);
'Data'[STATUS] = TRUE()
);
'Data'[PRODUCTID];", "
)Br,
Magnus
- iamprajot8 years ago
Responsive Resident
It is working and I am accepting it as a solution however if you could tell me any other simpler way then it would be great as it seems a lot confusing.