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
Ivan_C
Helper I
Helper I

Sales data by item, custom histogram by total ticket value

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!

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Ivan_C,

 

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

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
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?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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/


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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

DataInsights
Super User
Super User

@Ivan_C,

 

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

 





Did I answer your question? Mark my post as a solution!

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

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.