cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User II
Super User II

@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

 

View solution in original post

7 REPLIES 7
Super User III
Super User III

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

Super User II
Super User II

@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

 

View solution in original post

Hi,

Thanks for the quick response.

I will try out your solution as soon as possible.

Much appreciated!

Ivan

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite with Arun Ulag

Featured Session: Drive Data Culture with Power BI- Vision, Strategy & Roadmap. Register here https://myignite.microsoft.com #MSIgnite #PowerPlatform #Power BI ​

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors