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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

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

@Anonymous,

 

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

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  @Anonymous ,

 

Is your issue solved now?

 

Best Regards,
Kelly

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

Anonymous
Not applicable

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

@Anonymous,

 

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!




Anonymous
Not applicable

Hi,

Thanks for the quick response.

I will try out your solution as soon as possible.

Much appreciated!

Ivan

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors