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
Anonymous
Not applicable

Count of Orders per User ID within a time frame

Hi,

 

I have a table (Orders) that contains information about orders: User_id, Order_date and Order_price.

This table is linked to a date.table. What I would like to have is a measure that counts how many users made 1,2,3,4,5,.... orders. Basically a histogram of count of orders per user.  I need to be able to filter this measure later on based on specific dates.

 

Maybe I don't have to realize this in a measure but in a seperate table or column? Not really sure how to proceed here. Any help is appreciated. I have created this measure using SUMMARIZE in a seperate table, but this is of course no longer sensitive to filtering by order date.

 

 

 

Best

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Do you want to use histogram to show the number of orders per user in each time period?

Please refer to the pbix

If I understand it wrong, please provide some sample data and the results you expect.

 

Best Regards,
Liang
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

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem sloved?
If not, please let me know.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, you use the date in the date table as the slicer and create a relationship between two tables.

You can try the DAX:

count_id =
CALCULATE (
    COUNT ( Orders[User_id] ),
    FILTER (
        ALLEXCEPT ( Orders, Orders[User_id] ),
        Orders[Order_date] IN VALUES ( 'Date'[Date] )
    )
)
See the pbix for details.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @V-lianl-msft ,

 

thanks for your input. Unfortunately the code doesn't produce the output I require. What it does produce is a histogram that shows for every individual user_id the number of orders that individual has placed.

 

What I need however is a histogram that shows the number (count) of users that have place 1, 2, 3, ... orders in the specified time period. Would you have an idea how to do that?

 

Cheers,

Lukas

Hi @Anonymous ,

 

Do you want to use histogram to show the number of orders per user in each time period?

Please refer to the pbix

If I understand it wrong, please provide some sample data and the results you expect.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.