Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Find % of category of the total in a month

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:

 

DateIDCategory
1/1/2021A001Standard
1/1/2021A002Standard
1/1/2021A003Emergency
1/4/2021A004Emergency
1/5/2021A005Standard
1/6/2021A006Standard
1/7/2021A007Emergency
1/8/2021A008Standard
2/1/2021A009Standard
2/2/2021A010Emergency
2/3/2021A011Standard
2/3/2021A012Standard
2/3/2021A013Emergency
2/6/2021A014Standard
2/7/2021A015Standard
2/7/2021A016Standard
2/9/2021A017Emergency
2/10/2021A018Standard
3/1/2021A019Standard
3/1/2021A020Emergency
3/1/2021A021Emergency
3/4/2021A022Standard
3/6/2021A023Emergency
3/6/2021A024Standard
3/7/2021A025Emergency

 

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

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

2.PNG

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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

2.PNG

 

Best Regards,

Jay

amitchandak
Super User
Super User

@Anonymous , Try a new measure like

 

divide(calculate(count(Table[ID]),filter(Table,Table[Category] = "Standard")),count(Table[ID]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.