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.
Hi all,
I have a huge amount of sales data (ticket ID, date, item name, quantity, turnover). This data is on item level with a unique ticket ID. So each ticket ID can have multiple items.
Now, I would like to make a histogram with different customized bin sizes based on the total ticket value.
For example: how many tickets are there with a total ticket value of 0-50€, 50-100€, 100-300€, 300-900€, and so on.
I'm a quite lost in solving this with Dax so any help to get me in the right direction would be great!
Thanks in advance!
Solved! Go to Solution.
Try this calculated column. You can add additional groupings to the SWITCH function.
Group =
VAR vTicketID = SalesTest[Ticket ID]
VAR vTicketRows =
FILTER ( SalesTest, SalesTest[Ticket ID] = vTicketID )
VAR vTotalQuantity =
SUMX ( vTicketRows, SalesTest[Quantity] )
VAR vResult =
SWITCH (
TRUE (),
vTotalQuantity > 0
&& vTotalQuantity <= 50, "0-50",
vTotalQuantity > 50
&& vTotalQuantity <= 100, "50-100"
)
RETURN
vResult
Proud to be a Super User!
Hi,
Share some data to work with. Should the total ticket value be determined by adding up the figures in the turnover column?
Hi Ashish,
Thanks for the reply.
Unfortunately I cannot share any of the data.
The idea is indeed to see the total of the ticket value (sum of the different item on the ticket) in different bins.
Enjoy your day,
Ivan
Hi,
See if my solution at this link helps - http://www.ashishmathur.com/segment-customers-into-dynamic-buckets/
Hi @Ivan_C ,
Is your issue solved now?
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hi Kelly,
I still need to check the suggestions posted here. As soon as I've been able to I'll let you know.
Thanks,
Ivan
Try this calculated column. You can add additional groupings to the SWITCH function.
Group =
VAR vTicketID = SalesTest[Ticket ID]
VAR vTicketRows =
FILTER ( SalesTest, SalesTest[Ticket ID] = vTicketID )
VAR vTotalQuantity =
SUMX ( vTicketRows, SalesTest[Quantity] )
VAR vResult =
SWITCH (
TRUE (),
vTotalQuantity > 0
&& vTotalQuantity <= 50, "0-50",
vTotalQuantity > 50
&& vTotalQuantity <= 100, "50-100"
)
RETURN
vResult
Proud to be a Super User!
Hi,
Thanks for the quick response.
I will try out your solution as soon as possible.
Much appreciated!
Ivan
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |