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 there,
I have the following matrix with subtotals, totals and percentages:
I made the following DAX formulas to calculate OU%:
OU% = OverigeUren% = Calculate(CONCATENATE(FIXED(DIVIDE([OverigeUren];[GrandTotal];0)*100;2;0);"%")) OU = OverigeUren = CALCULATE(SUM(EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED]); FILTER(EMPLOYEE;EMPLOYEE[LABOR_TICKET.1.INDIRECT_ID]<>"")) GT = GrandTotal = [OverigeUren]+[ProjectUren]
As can be seen the total of OU%, which is 46,90%, is correct. However, the subtotals of OU% are alle 100%. How can I modify the DAX such that the subtotal percentages sum up to to 46,90% on the basis of the corresponding subtotals in the OU column?
So I want the subtotals of the OU column and OU% column to show:
OU: OU%:
6.00 1,12
23,02 4,29
...... ......
251,52 46,90%
So the calculation then become 6/536,27=0,0112 * 100 = 1,12 etc.
UPDATE
Ok I now managed to do the following, which yields the desired result:
OverigeUren% = CALCULATE(DIVIDE(CALCULATE(sum(EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED]);FILTER(EMPLOYEE;EMPLOYEE[LABOR_TICKET.1.INDIRECT_ID]<>""));536,27)*100)
However, if I replace the 536,27 by sum(EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED]), I get the same result again as in the image above.....
Solved! Go to Solution.
Hi @v-huizhn-msft. Never mind. Got a solution . The solution I am using is as follows:
OverigeUren% = CALCULATE(DIVIDE(CALCULATE(sum(EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED]);FILTER(EMPLOYEE;EMPLOYEE[LABOR_TICKET.1.INDIRECT_ID]<>""));CALCULATE(SUMX(VALUES(EMPLOYEE[LABOR_TICKET.1.INDIRECT_ID]);EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED]);ALLSELECTED(EMPLOYEE)))*100)
Thank you very much for your support.
Hi @Cootje16,
Please create use the formula below and check if it works fine.
OverigeUren% = VAR SS = SUM ( EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED] ) RETURN CALCULATE ( DIVIDE ( CALCULATE ( SUM ( EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED] ), FILTER ( EMPLOYEE, EMPLOYEE[LABOR_TICKET.1.INDIRECT_ID] <> "" ) ), SS ) * 100 )
If you still have issue, you'd better share your .pbix file for further analysis.
Best Regards,
Angelia
Thanks @v-huizhn-msft for your solution. However, your solution still yields the same result as the results in the picture I posted in my first post. You can download my PBIX file on the following link:
https://drive.google.com/file/d/1BBbFm1g9mt8vRHGTvBSlTbggST6JFd_d/view?usp=sharing
Hi @v-huizhn-msft. Never mind. Got a solution . The solution I am using is as follows:
OverigeUren% = CALCULATE(DIVIDE(CALCULATE(sum(EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED]);FILTER(EMPLOYEE;EMPLOYEE[LABOR_TICKET.1.INDIRECT_ID]<>""));CALCULATE(SUMX(VALUES(EMPLOYEE[LABOR_TICKET.1.INDIRECT_ID]);EMPLOYEE[LABOR_TICKET.1.HOURS_WORKED]);ALLSELECTED(EMPLOYEE)))*100)
Thank you very much for your support.
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 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |