Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Team,
I have 2 tables in the backend:
Country | Compliant Full |
US | 4 |
Ind | 11 |
Country | Year | Compliant Year |
US | 2020 | 3 |
US | 2021 | 0 |
Ind | 2020 | 1 |
Ind | 2021 | 2 |
I have simple power bi report in which there are 2 slicers : Country and Year and in table visual i wanted to show 2 columns
Country and Compliant
when user filter only on Country then 2nd column should show value from Compliant full and when user chooses Country + Year or Just year then 2nd column should show value from Compliant Year.
I used belwo DAX measure Compliant = IF(HASONEVALUE(Table2(Year), SUM(Compliant year), SUM(Compliant Full))
But it is giving me incorrect result in the Total of the table.
Could you please help me on this ?
Thanks,
Shubham
Solved! Go to Solution.
@Anonymous , Problem That tell why we need calculate in SUMX
Measure = sumx(values(Country[country]), CALCULATE(IF(HASONEVALUE(Table2[Year]), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full]))))
Please find the file after signature
It worked !! Thank you so much bhai !!
@Anonymous , Please accept the appropriate solution.
@Anonymous , First on all create a common table country and use that in visual and have measure like
Country = distinct(Distinct(Table[Country]), distinct(Table2[country]))
sumx(Country, IF(HASONEVALUE(Table2(Year)), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full])))
@Anonymous , Try this small change
sumx(values(Country[country]), IF(HASONEVALUE(Table2(Year)), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full])))
No. Still it is giving same result.
@Anonymous , Problem That tell why we need calculate in SUMX
Measure = sumx(values(Country[country]), CALCULATE(IF(HASONEVALUE(Table2[Year]), SUM(Table2[Compliant year]), SUM(Table1[Compliant Full]))))
Please find the file after signature
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |