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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Need help with Grouping Data

 

Hello everybody! I can't GROUPBY my count of my purchases by count of my clients. 
That's user table:       
   

  Users.jpg

That's purchase's table:       
         

      purchases.jpg
And that's what I want:

What_I_Want.jpg
All this data must be filtered by date slice!

Help me please)

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

try this approach.
See the attached file as well

 

First create a calculated table

 

NewTable =
SELECTCOLUMNS (
    GENERATESERIES ( 1, MAX ( Purchases[Count of Purchases] ) ),
    "Count of Purchases", [Value]
)

Then a Measure

 

No. of users =
COUNTROWS (
    FILTER (
        VALUES ( Purchases[UserId] ),
        CALCULATE ( COUNT ( Purchases[UserId] ) )
            = SELECTEDVALUE ( NewTable[Count of Purchases] )
    )
)

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

Hi @Anonymous 

 

In your Purchases Table, you can add this calculated column

Please see attached file with your sample data

Count of Purchases =
CALCULATE (
    COUNT ( Purchases[UserId] ),
    ALLEXCEPT ( Purchases, Purchases[UserId] )
)

Then in Table Visual, you can drag the above calculated column and DistinctCount of UserId to get the desired result

Anonymous
Not applicable

@Zubair_Muhammad  Thank you for answer) But it work wrong when I filtring data with date slicer! Please check my example: https://www.dropbox.com/s/apwwg61aq7ty9or/ExampleWithDate.pbix?dl=0

Hi @Anonymous 

 

try this approach.
See the attached file as well

 

First create a calculated table

 

NewTable =
SELECTCOLUMNS (
    GENERATESERIES ( 1, MAX ( Purchases[Count of Purchases] ) ),
    "Count of Purchases", [Value]
)

Then a Measure

 

No. of users =
COUNTROWS (
    FILTER (
        VALUES ( Purchases[UserId] ),
        CALCULATE ( COUNT ( Purchases[UserId] ) )
            = SELECTEDVALUE ( NewTable[Count of Purchases] )
    )
)
Anonymous
Not applicable

@Zubair_Muhammad , this is so great!Smiley Happy But there is one thing: is there any way to filter list of users, when I click on the cell of "Count of Purchases"?

@Anonymous 

 

I think you can establish a relationship between the columns "Count of Purchases" in Purchases and New Table

 

Then it would work

Anonymous
Not applicable

@Zubair_Muhammad Thank you! It works! I will try this on a large amount of data 😃

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.