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
jasonbakersd
Helper I
Helper I

Help with DAX measure - Unique Members within Bins

 

I'm having trouble creating a measure that will show total unique members by Bins based on the sum of thier individual fact rows.

 

 

The table on the right shows is what I'm trying to create with DAX as opposed to single purpose reporting table.

 

The fact table has the number of prescription drug refills by member.   

 

If member 123 has 3 refills of a drug, he or she will fall into the 3 bin.   I only count member 123 once.

 

Any help greatly appreciated. 

 

Jason

 

Bins.png

 

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@jasonbakersd

 

In your scenario, I think you can add a calculated column for "refill times" in your fact table. 

 

Refill Times = CALCULATE(COUNTROWS(),ALLEXCEPT('Fact','Fact'[Drug],'Fact'[Member]))

Then create a measure to distinct count members group on Drug and Refill Times.

 

 

Distinct Members = CALCULATE(DISTINCTCOUNT('Fact'[Member]),ALLEXCEPT('Fact','Fact'[Drug],'Fact'[Refill Times]))

55.PNG

 

Regards,

View solution in original post

3 REPLIES 3
v-sihou-msft
Employee
Employee

@jasonbakersd

 

In your scenario, I think you can add a calculated column for "refill times" in your fact table. 

 

Refill Times = CALCULATE(COUNTROWS(),ALLEXCEPT('Fact','Fact'[Drug],'Fact'[Member]))

Then create a measure to distinct count members group on Drug and Refill Times.

 

 

Distinct Members = CALCULATE(DISTINCTCOUNT('Fact'[Member]),ALLEXCEPT('Fact','Fact'[Drug],'Fact'[Refill Times]))

55.PNG

 

Regards,

Simon, 

 

I've implemented this and it works great.   My only change was to add formatting to the Refill column to place any count 5 or greater into a 5+ bucket.

 

Thanks again for the help!

 

 

Thanks, I'll take a crack using your suggestions.

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.