cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tangcy123
Helper I
Helper I

How to display the user count correctly group by order count?

Hi,

how to display the user count group by order count? 

There are 5 groups for order count as below:  1 , 2, 3-5, 6-10, 11+ , I would like to get user count base on the OrderGroup.

but it always display all user count 9 for the group 11+, but display 0 for other group,  who can help check it?  is something error in my DAX code?

 

tangcy123_0-1656579822015.png

 

tangcy123_1-1656580032328.png

tangcy123_2-1656580612403.png

 

 

DAX code for UserCountGroup:

 

 
UserCount =
IF(ISFILTERED('OrderGroup'[OrderGroup]),
CALCULATE(
DISTINCTCOUNT('Order'[userid_id]),
FILTER('Order',
AND(
COUNT('Order'[order_no]) <=SELECTEDVALUE('OrderGroup'[Max]),
COUNT('Order'[order_no]) >=SELECTEDVALUE(OrderGroup[Min])
)

)
),
DISTINCTCOUNT('Order'[userid_id] )
) + 0
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @tangcy123 ;

Create two measure.

Count = CALCULATE(COUNT('Table'[id]),FILTER(ALL('Table'),[id]=MAX('Table'[id])))
Measure = 
 CALCULATE(DISTINCTCOUNT('Table'[id]),FILTER('Table',[Count]<=MAX('Group'[Max])&&[Count]>=MAX('Group'[Min])))

The final show:

vyalanwumsft_0-1656925480854.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @tangcy123 ;

Create two measure.

Count = CALCULATE(COUNT('Table'[id]),FILTER(ALL('Table'),[id]=MAX('Table'[id])))
Measure = 
 CALCULATE(DISTINCTCOUNT('Table'[id]),FILTER('Table',[Count]<=MAX('Group'[Max])&&[Count]>=MAX('Group'[Min])))

The final show:

vyalanwumsft_0-1656925480854.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@tangcy123 , Are you trying to use this to bucket a measure ? if yes refer

 

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors