Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hi,
I need to calculate the percentages of each meal type out of the overall meals. So if ice cream was 1 out of 2, it would be 50%.
I want my numerator to be all the values in the meal column regardless of a meal filter being applied (with all other filters such as date still working) and my denominator to be the filtered meal value.
Could you advise me on a dax measure for this?
ID | Date | Meal |
430 | 13-May-22 | Ice Cream |
509 | 24-May-22 | Ice Cream |
601 | 31-May-22 | Cake |
676 | 13-Jun-22 | Cake |
785 | 21-Jun-22 | Cake |
894 | 28-Jun-22 | Crisps |
996 | 06-Jul-22 | Ice Cream |
996 | 06-Jul-22 | Cake |
1045 | 12-Jul-22 | Ice Cream |
1134 | 19-Jul-22 | Ice Cream |
1168 | 21-Jul-22 | Sweets |
1268 | 28-Jul-22 | Ice Cream |
1460 | 10-Aug-22 | Crisps |
1598 | 22-Aug-22 | Cake |
1598 | 22-Aug-22 | Cake |
1600 | 22-Aug-22 | Crisps |
1600 | 22-Aug-22 | Crisps |
1619 | 23-Aug-22 | Sweets |
1619 | 23-Aug-22 | Cake |
1619 | 23-Aug-22 | Ice Cream |
1619 | 23-Aug-22 | Ice Cream |
1634 | 23-Aug-22 | Cake |
1645 | 24-Aug-22 | Sweets |
1730 | 31-Aug-22 | Cake |
1734 | 31-Aug-22 | Cake |
1792 | 06-Sep-22 | Cake |
1792 | 06-Sep-22 | Sweets |
1792 | 06-Sep-22 | Ice Cream |
1833 | 09-Sep-22 | Cake |
1857 | 13-Sep-22 | Ice Cream |
1857 | 13-Sep-22 | Cake |
1894 | 16-Sep-22 | Ice Cream |
1903 | 16-Sep-22 | Cake |
1964 | 23-Sep-22 | Cake |
1964 | 23-Sep-22 | Cake |
1987 | 27-Sep-22 | Cake |
1987 | 27-Sep-22 | Sweets |
2049 | 04-Oct-22 | Crisps |
2139 | 12-Oct-22 | Cake |
2139 | 12-Oct-22 | Crisps |
2199 | 19-Oct-22 | Sweets |
2199 | 19-Oct-22 | Sweets |
2213 | 20-Oct-22 | Cake |
2213 | 20-Oct-22 | Cake |
2213 | 20-Oct-22 | Cake |
2213 | 20-Oct-22 | Ice Cream |
2213 | 20-Oct-22 | Cake |
2213 | 20-Oct-22 | Sweets |
Thank you in advance
Thanks both, neither of these work for me unfortunately. @Arul I need to be able to see change over time, not the total percentages for all the values.
@Padycosmos the measure works when I put it into a table or a matrix, the problem I have got is that when I put it into a line chart it works when all values are selected, but then when I select a particular value, it goes to 100% as the value is being filtered to that value. Images below:
These percentages are correct but then if want to highlight one to see performance, this happens:
Is there a way to get it to work on whe selecting individual values?
Hope this measure helps:
Hope this helps:
try this code in measure,
Percentage of Meals =
VAR _countOfMeals = COUNT(YourTablename[Meal])
VAR _countOfAllMeals = CALCULATE(
COUNT(YourTablename[Meal]),
ALL(YourTablename)
)
VAR _result = DIVIDE(_countOfMeals,_countOfAllMeals)
RETURN _result
and then format measure as a percentage (refer the image attached),
Result:
Thanks,
Arul