Forum Discussion

Aglaerion's avatar
Aglaerion
New Member
2 years ago
Solved

Use Slider selectedvalue in calculation and plot results in circlediagram view

Hi Guys, I am trying to use the value I select in a slider(ticket price) to calculate a total cost price(nr of kids * ticketprice). After that I check in which price category the total cost comes...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Aglaerion ,

    Please try the following methods and check if they can solve your problem:

    1.Create the simple tables.

    2.Select the slicer visual and drag the Ticket price into the slicer.

    3.Create a new measure to calculate total. Enter the following DAX formula.

     

    Total Cost = 
    VAR SelectedTicketPrice = SELECTEDVALUE(Slicer[Ticket price], 0)
    VAR NumberOfKids = SUM(Person[Kids])
    RETURN
    NumberOfKids * SelectedTicketPrice

     

     

    4.Drag the Total cost to the visual.

    5.Create a new measure to calculate category. Enter the following DAX formula.

     

    Cost Category = 
    SWITCH(
        TRUE(),
        [Total Cost] < 20, "CAT1",
        [Total Cost] >= 20 && [Total Cost] < 30, "CAT2",
        [Total Cost] >= 30, "CAT3",
        "OTHER"
    )

     

     

    6.Create three measures for the category.

     

    Category1 = 
    CALCULATE(
        COUNTROWS(Person),
        FILTER(
            Person,
            [Cost Category] = "CAT1"
    ))
    Category2 = 
    CALCULATE(
        COUNTROWS(Person),
        FILTER(
            Person,
            [Cost Category] = "CAT2"
    ))
    Category3 = 
    CALCULATE(
        COUNTROWS(Person),
        FILTER(
            Person,
            [Cost Category] = "CAT3"
    ))

     

     

    7.Drag three measures into the pie chart. The result is shown below.

     

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.