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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MadhuriReddy
New Member

Count of Occurrences of a measure

In PowerBI, I am trying to figure out how to perform a count of stores based upon the percentage groups

 

PCNT_Measure = DIVIDE(SUM('Table'[Visit]), SUM('Table'[Schedule]))
 

MadhuriReddy_1-1680257763352.png

For example, if all 4 months are selected

The desired result would be:
100% = 3 stores
75% = 1 store
50% = 2 stores

MadhuriReddy_2-1680257790352.png

This count/percentage would then change if different months were selected.

For example, if only months 1 through 3 were selected...
...then the count would be:

100% = 3 stores
66.7% = 3 stores

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @MadhuriReddy 

 

You can use the following measure. This measure works when adding it to a visual which has [Store] column. If the visual doesn't have the [Store] column, the variable _pcnt cannot get the correct result then COUNTROWS would probably return a blank result.  

Count_PCNT = 
var _t = SUMMARIZE(ALLSELECTED('Table'),'Table'[Store],"PCNT",[PCNT_Measure])
var _pcnt = [PCNT_Measure]
return
COUNTROWS(FILTER(_t,[PCNT]=_pcnt))

vjingzhang_0-1680488588832.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @MadhuriReddy 

 

You can use the following measure. This measure works when adding it to a visual which has [Store] column. If the visual doesn't have the [Store] column, the variable _pcnt cannot get the correct result then COUNTROWS would probably return a blank result.  

Count_PCNT = 
var _t = SUMMARIZE(ALLSELECTED('Table'),'Table'[Store],"PCNT",[PCNT_Measure])
var _pcnt = [PCNT_Measure]
return
COUNTROWS(FILTER(_t,[PCNT]=_pcnt))

vjingzhang_0-1680488588832.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thank you @v-jingzhang 

MadhuriReddy
New Member

Sample Data

StoreMonthScheduleVisit
Store #012022_0111
Store #012022_0211
Store #012022_0311
Store #012022_0411
Store #022022_0111
Store #022022_021 
Store #022022_0311
Store #022022_0411
Store #032022_0111
Store #032022_0211
Store #032022_031 
Store #032022_041 
Store #042022_0111
Store #042022_0211
Store #042022_0311
Store #042022_0411
Store #052022_0111
Store #052022_0211
Store #052022_0311
Store #052022_0411
Store #062022_011 
Store #062022_0211
Store #062022_0311
Store #062022_041 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors