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,
I want to get pecentage per group i.e Total value of a Group/ Total Value
I am trying to get total value of all groups from the data table but when I put that measure in a table it gets divided by groups which I don't want.
If I used "ALL" in measure then it will even ignore Date but I need my measure to be filtered by date not by group.
Data Table:
ID | Group | Date |
12 | TUI | 01/02/2023 |
13 | FOR | 02/02/2023 |
14 | GPP | 03/02/2023 |
15 | FOR | 04/02/2023 |
16 | FOR | 05/02/2023 |
17 | TUI | 06/02/2023 |
18 | FOR | 07/02/2023 |
19 | GPP | 08/02/2023 |
20 | GPP | 09/02/2023 |
Output Table:
Table Columns | Measure | ||
Group | Count | Total Count | Percentage |
TUI | 2 | 8 | 0.25 |
FOR | 4 | 8 | 0.5 |
GPP | 3 | 8 | 0.375 |
Measure that I Created:
Solved! Go to Solution.
Hi @Raj12 ,
Why is the total 8 and not 9?
Please check if this is your expected output.
pecentage per group =
VAR _count = COUNTROWS('Table')
VAR _count_all = CALCULATE(COUNTROWS('Table'),ALL())
VAR _result = DIVIDE(_count,_count_all)
RETURN
_result
If you need the total to always be at 100%, try this.
VAR _count = COUNTROWS('Table')
VAR _count_all = CALCULATE(COUNTROWS('Table'),ALLSELECTED())
VAR _result = DIVIDE(_count,_count_all)
RETURN
_result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @Raj12 ,
Why is the total 8 and not 9?
Please check if this is your expected output.
pecentage per group =
VAR _count = COUNTROWS('Table')
VAR _count_all = CALCULATE(COUNTROWS('Table'),ALL())
VAR _result = DIVIDE(_count,_count_all)
RETURN
_result
If you need the total to always be at 100%, try this.
VAR _count = COUNTROWS('Table')
VAR _count_all = CALCULATE(COUNTROWS('Table'),ALLSELECTED())
VAR _result = DIVIDE(_count,_count_all)
RETURN
_result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Can anyone please help me out on this?
Thanks
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.