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

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.