The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Let me illustrate:
In power BI I have a rather complex measure "Metric1", it is already calculated but I need to show the sum for each country and use it to be able to calculate the percentage that corresponds to each client.
How could I do that subtotal calculation on a measure in Power BI?
Solved! Go to Solution.
You can create two neasures, one is total_pais, another is %
TOTAL_PAIS =
VAR a =
SUMMARIZE (
ALLSELECTED ( 'Table' ),
[COD_PAIS],
[COD_CLIENTE],
"Measure", [measure1]
)
RETURN
SUMX ( FILTER ( a, [COD_PAIS] IN VALUES ( 'Table'[COD_PAIS] ) ), [Measure] )
%Client/Total_Pais =
DIVIDE ( [measure1], [TOTAL_PAIS] )
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
In power BI I have a rather complex measure "MEASURE1", it is already calculated but I need to show the sum for each country and use it to be able to calculate the percentage that corresponds to each client.
The first three columns represent what I already have and the last two the expected result, if they were data from the table there would be no problem but as they are calculated measurements I can't find a solution to do it in a powerbi matrix
COD_PAIS | COD_CLIENTE | measure1 | TOTAL_PAIS | %Client/Total_Pais |
1 | 1 | 15 | 75 | 20% |
1 | 2 | 20 | 75 | 26,67% |
1 | 3 | 40 | 75 | 53,33% |
2 | 4 | 32 | 58 | 55,17% |
2 | 5 | 26 | 58 | 44,83% |
3 | 6 | 10 | 10 | 100% |
You can create two neasures, one is total_pais, another is %
TOTAL_PAIS =
VAR a =
SUMMARIZE (
ALLSELECTED ( 'Table' ),
[COD_PAIS],
[COD_CLIENTE],
"Measure", [measure1]
)
RETURN
SUMX ( FILTER ( a, [COD_PAIS] IN VALUES ( 'Table'[COD_PAIS] ) ), [Measure] )
%Client/Total_Pais =
DIVIDE ( [measure1], [TOTAL_PAIS] )
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523