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.
Power BI newbie here
I'm trying to calculate Percentage of each category in a given month and display via line graph to show the trend
Data is as below:
Date | ID | Category |
1/1/2021 | A001 | Standard |
1/1/2021 | A002 | Standard |
1/1/2021 | A003 | Emergency |
1/4/2021 | A004 | Emergency |
1/5/2021 | A005 | Standard |
1/6/2021 | A006 | Standard |
1/7/2021 | A007 | Emergency |
1/8/2021 | A008 | Standard |
2/1/2021 | A009 | Standard |
2/2/2021 | A010 | Emergency |
2/3/2021 | A011 | Standard |
2/3/2021 | A012 | Standard |
2/3/2021 | A013 | Emergency |
2/6/2021 | A014 | Standard |
2/7/2021 | A015 | Standard |
2/7/2021 | A016 | Standard |
2/9/2021 | A017 | Emergency |
2/10/2021 | A018 | Standard |
3/1/2021 | A019 | Standard |
3/1/2021 | A020 | Emergency |
3/1/2021 | A021 | Emergency |
3/4/2021 | A022 | Standard |
3/6/2021 | A023 | Emergency |
3/6/2021 | A024 | Standard |
3/7/2021 | A025 | Emergency |
What is want to show is for each month (Jan, Feb, March etc..) what is the % of Standard of the total for that month and calculate the same for each month
Solved! Go to Solution.
Hi @Anonymous ,
Check the measure.
Measure =
var _total = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),'Table'[Date].[Month]=SELECTEDVALUE('Table'[Date].[Month])))
var _category = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),'Table'[Date].[Month]=SELECTEDVALUE('Table'[Date].[Month])&&'Table'[Category]=SELECTEDVALUE('Table'[Category])))
return
_category/_total
Best Regards,
Jay
Hi @Anonymous ,
Check the measure.
Measure =
var _total = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),'Table'[Date].[Month]=SELECTEDVALUE('Table'[Date].[Month])))
var _category = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),'Table'[Date].[Month]=SELECTEDVALUE('Table'[Date].[Month])&&'Table'[Category]=SELECTEDVALUE('Table'[Category])))
return
_category/_total
Best Regards,
Jay
@Anonymous , Try a new measure like
divide(calculate(count(Table[ID]),filter(Table,Table[Category] = "Standard")),count(Table[ID]))
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 |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |