The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi all I have a sales order table
OrderID CustomerID ProductID Date etc
I have been asked to group the number of customer by count of their orders and I am able to do so. Following is the example of what I did.
First I created a segment table with one column
Pic 1
Total SalesOrder(In Pic 1) = countrows(SalesOrder)
The table 'LinkSalesOrder' is created as follows;
Pic 2
I referred the only column of the above table No of orders as Selected Segment( Selected Segment = Selected Value(LinkSalesOrder[No of orders]) This measure is branched in following dax in image(Pic 3)
The above table will give me a table with column from 1 to the X number of rows (where x is a maximum number of order a certain customer has made). So, the segment table ranges from 1 to 1680. Thats quite a large range. I did following to ascertain number of customer with x number of orders
Pic 3-
Once I did this I got following in my visualization as table.
Table - 1
Now the problem is I cannot group the number of placement into range like 1-5 orders, 6-10 orders. I applied the range logic in the LinkSalesOrder table and created a new column with ranges. Following is the image of table LinkSalesOrder
Pic 4
However, whenever I put a Range in a table visualization and add the measure [Count of Customer with x no of ordersss] (pic 3), I get blank. For example, for range 1-5 orders, it is not aggregating the total customer who placed 1,2,3,4,5 count of orders.
I need to be able to get those [count of customer with x no of ordersss] using Dax, because there are a lot of granularity in the data that users do want to slice by. Also the data is ranged from 2010, so group by in Power Query would not be any helpful. Is there any other way I can Assign range to it.
Referring to Table 1. Following is the result I want.
Table - 2
Order Ranges | No of Customer who ordered between X Range |
1-5 orders | 1200 |
100-500 orders | 90 |
More than 500 orders | 20 |
But following is the result I am getting
Pic-5
It works as follows when No of order column is there. But as soon as I take number of orders out. It gives me result as in Pic-5
I have tried multiple workarounds but so far I am unsuccessful. Is there anyway I can apply range to the number of orders and group the count of those customer in a relevant range?
Your response will be highly appreciated
Hi @shekhar_shres ,
You need to create a dimension table such as below:
Range |
1 to 5 Placement |
5-10 Placement |
10-20 Placement |
Then create a measure to link the dimension with your measures.
If you are still frustrated,pls provide some dummy data with expected output for test.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!