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.
I want to calculate Row percentage of product on row basis.
for example, I have dimCountry, dimProduct and FactTable, I put them in matrix visual as show below
What i want to achieve is percentage of country per product on row basis as shown below
How can I achieve this using dax
Solved! Go to Solution.
Hi @Anonymous ,
The DAX might change based on the FactTable Structure. But assuming the below is the FactTable structure, I have given the DAX
You can use the below DAX for this
Product% =
VAR Numerator = CALCULATE(SUM(FactTable[Numbers]), REMOVEFILTERS(dimCountry[Country]), VALUES(dimCountry[Country]))
VAR Denominator = CALCULATE(SUM(FactTable[Numbers]), REMOVEFILTERS(dimProduct[Product]))
RETURN
DIVIDE(Numerator, Denominator)
Set the format of the Product% to Percentage
If you share the table structure may be that could help!!
Regards,
Hi @Anonymous ,
The DAX might change based on the FactTable Structure. But assuming the below is the FactTable structure, I have given the DAX
You can use the below DAX for this
Product% =
VAR Numerator = CALCULATE(SUM(FactTable[Numbers]), REMOVEFILTERS(dimCountry[Country]), VALUES(dimCountry[Country]))
VAR Denominator = CALCULATE(SUM(FactTable[Numbers]), REMOVEFILTERS(dimProduct[Product]))
RETURN
DIVIDE(Numerator, Denominator)
Set the format of the Product% to Percentage
If you share the table structure may be that could help!!
Regards,
Hi,
Please check the below picture and the attached pbix file.
Percentage measure: =
VAR _bycountry =
CALCULATE ( [Count measure:], ALLEXCEPT ( 'Fact', Country[Country] ) )
RETURN
IF ( HASONEVALUE ( Country[Country] ), DIVIDE ( [Count measure:], _bycountry ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
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 |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |