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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Aglaerion
New Member

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 into. CAT1, 2 or 3.
Finally I want to show the count of the category in a pie chart view.

I have 2 very simple tables. The first is Person, containing the name of the parent, and the number of kids he has.
The 2nd table is the Slicer table containing the ticket price from 1-10.

The first thing I noticed is that I can not make calulations with the slicer if the column kids is not a measure.
So I created a measure, but it forces me to use SUM, MIN or MAX to do it.
After that I can calculate with the slicer. But that gives at the bottom the result of SUM, MIN or MAX.
I dont want that. Because I want to make a 2nd calculation, and that is the pricecategorie. (CAT1, 2 or 3)
And then I want to count how many parents are in CAT1, how many in CAT2 and how many are in CAT3.
And that result I want to show in my pie chart. This last step I can not manage to do somehow. It only shows one (SUM, MIN or MAX) result from the table in the pie chart view.

Can someone please help me out with this? Below you see a screenshot with my data tables, measures and the pie chart view I like to create. The middle table is on there so you can see what the calculation results are.

Oefenbestand2.jpg

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Aglaerion ,

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

1.Create the simple tables.

vjiewumsft_0-1707812068238.png

vjiewumsft_1-1707812081516.png

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

vjiewumsft_2-1707812089905.png

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.

vjiewumsft_3-1707812162617.png

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.

vjiewumsft_4-1707812242892.png

 

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.

 

View solution in original post

2 REPLIES 2
Aglaerion
New Member

Tx bro, the solution was that I had indeed create measures for the categories each with the count statement.

I used this :

 

CAT1 = COUNTX(FILTER('Person',[Category]="CAT1"),[Category])

CAT2 = COUNTX(FILTER('Person',[Category]="CAT2"),[Category])

CAT3 = COUNTX(FILTER('Person',[Category]="CAT3"),[Category])
 
Then I dragged those into the pie chart.
Tx for the headsup mate. Apreciated!
Anonymous
Not applicable

Hi @Aglaerion ,

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

1.Create the simple tables.

vjiewumsft_0-1707812068238.png

vjiewumsft_1-1707812081516.png

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

vjiewumsft_2-1707812089905.png

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.

vjiewumsft_3-1707812162617.png

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.

vjiewumsft_4-1707812242892.png

 

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.

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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