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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
lowerCamelCase
Frequent Visitor

How to make measure for customers with x amount of orders per day (to be used line chart)

Hello! First post here!

 

Just starting to learn PowerBi and still a bit lost in what is measure and when to use vs colums, so bare with me..

 

I will try to simplify my case, for this to be useful to other beginners. I want a line graph where on x-axis is dates and on the y-axis is 4 sets of data. Datapoints for each line represent sum of customers with x amount of orders. This graph would help to answer some questions, example: Which days people with 3 orders shop most likely? How much traffic is there in our shop, if we stop selling items that people with one order buy? etc..

 

The tables i have: Time Dimension and Orders. Linked by date in one-to-many, so Time Dimension table has date only once and Orders could contain multiple rows with the same date.

 

Orders  
Date Customer ID
1.1.2022SaturdayA
1.1.2022SaturdayB
1.1.2022SaturdayB
1.1.2022SaturdayC
1.1.2022SaturdayC
1.1.2022SaturdayC
2.1.2022SundayB
2.1.2022SundayB
2.1.2022SundayB
2.1.2022SundayA
2.1.2022SundayA
2.1.2022SundayA
3.1.2022MondayC

 

Time Dimension Table
DateDay
1.1.2022Saturday
2.1.2022Sunday
3.1.2022Monday

 

And the result should be:

Result Customers (total) with () orders
DateDay1234
1.1.2022Saturday1110
2.1.2022Sunday0020
3.1.2022Monday1000

 

Could this be built in four measures that i could drop to line graph with x-axis containing dates? And maybe sum these measures so that one line in graph would represent several groups (meaning: leave out customers with only 1 order, so Saturdays result would be 2 customers, Sunday 2 customers and Monday 0 customers)?

 

How would you approach this?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@lowerCamelCase , I think you need bucketing on the number of orders

 

I discussed one use case here - Dynamic segmentation -Measure to Dimension conversion: https://youtu.be/gzY40NWJpWQ

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@lowerCamelCase , I think you need bucketing on the number of orders

 

I discussed one use case here - Dynamic segmentation -Measure to Dimension conversion: https://youtu.be/gzY40NWJpWQ

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hey @amitchandak !

 

I think this solution will benefit people a lot! How ever, i'm stuck at the first minutes of the video. I'm trying to give this question more generalized context, so that i and others will understand of the concept that can be applied to other type of problems. The real data that i have is not actually "Orders", so there is no "Quantity" with integer.

Data on video:

lowerCamelCase_0-1662195166792.png

My Data (Actually customers also have CustomerHash and some of them are missing name and some names have two or more CustomerHash)

Orders
OrderHashDateCustomerID
SF644DG31XF8G1XFG381.1.2022A
SF644DG31XF8G1XFG391.1.2022B
SF644DG31XF8G1XFG401.1.2022B
SF644DG31XF8G1XFG411.1.2022C
SF644DG31XF8G1XFG421.1.2022C
SF644DG31XF8G1XFG431.1.2022C
SF644DG31XF8G1XFG442.1.2022B
SF644DG31XF8G1XFG452.1.2022B
SF644DG31XF8G1XFG462.1.2022B
SF644DG31XF8G1XFG472.1.2022A
SF644DG31XF8G1XFG482.1.2022A
SF644DG31XF8G1XFG492.1.2022A
SF644DG31XF8G1XFG503.1.2022C

 

So with this data i can't use SUM on the first step: Total Qty = Sum(Sales[Qty]), because the rows that i have are string (CustomerID). Well, i can use COUNT, to count the rows. Results in the Tables and measures from the Orders table to check the table gives wanted result.

 

First table 

//Get the sum of the of the rows in the context of Quantity, so 25 days with 1 order etc.. Sum of these matched with distinct count of OrderID's (all rows) in Orders table  

1 Sum of Customer Qty = SUMX(FILTER(VALUES('Customer'[CustomerID]), [Total Qty] = MAX('1 Qty Bucket'[Value])), [Total Qty]

 

Second table

// Sum of quantities in the context of customer

1 Sum of customer Qty1 = SUMX(VALUES('Orders'[Customer]), IF( [Total Qty] = 1, 1, BLANK())) etc.. Sum of these matches the measure Distinct count of CustomersID of the Orders table.
lowerCamelCase_0-1662202417346.png

 

The visuals and sum of these are work in progress, so if @amitchandak  can point me to other his great Youtube videos that will help with this case, it would be highly appreciated!

 

For this problem this was solution, so we can consider it solved! Thank you @amitchandak !!!!

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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