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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Measures in slicers

Hi,

I have a dataset (shorter version) with the following values:

The dataset is about Surveys where PID is assigned to one survey. Cycle time is a difference between 2 milestones expressed in days/weeks/months.

tvadoc_0-1666699596715.png

I'd like to create 3-3 slicers where I can change the measure and time span:

tvadoc_1-1666699615890.png

So basically, if I select Avg and Day, then on my Diagram, it'd show the Avg and the Day for each surveys, while the year is in the X axis, like this:

tvadoc_2-1666699780349.png

 

I tried with some DAX, but I'm not sure if this is the way. 

So basically I have a Measure selector and a Time span selector, and the following code copied for both:

 

tvadoc_3-1666699967679.png

 

 

Time span selection = SWITCH( TRUE(),
    AND(VALUES('Time span selector'[Time span selector]) = "Day", VALUES('Measure selector'[Measure selector]) = "Avg"), AVERAGE(final[Cycle time - DAYS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Week", VALUES('Measure selector'[Measure selector]) = "Avg"), AVERAGE(final[Cycle time - WEEKS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Month", VALUES('Measure selector'[Measure selector]) = "Avg"), AVERAGE(final[Cycle time - MONTHS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Day", VALUES('Measure selector'[Measure selector]) = "Min"), MIN(final[Cycle time - DAYS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Week", VALUES('Measure selector'[Measure selector]) = "Min"), MIN(final[Cycle time - WEEKS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Month", VALUES('Measure selector'[Measure selector]) = "Min"), AVERAGE(final[Cycle time - MONTHS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Day", VALUES('Measure selector'[Measure selector]) = "Max"), AVERAGE(final[Cycle time - DAYS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Week", VALUES('Measure selector'[Measure selector]) = "Max"), AVERAGE(final[Cycle time - WEEKS]),
    AND(VALUES('Time span selector'[Time span selector]) = "Month", VALUES('Measure selector'[Measure selector]) = "Max"), AVERAGE(final[Cycle time - MONTHS]),
    BLANK())

 

Is this how I'm supposed to do this so I can get the desired result?

 

Thank you for your help!

2 REPLIES 2
johnt75
Super User
Super User

I think you can do this with a couple of fields parameters. Create separate measures for the average, min and max and add them to one fields parameter. Pick the different columns you want to use from your date table and add those to another fields parameter, and then put the 2 different fields parameters on the axes of your chart.

Anonymous
Not applicable

Thank you for your answer, but I still need a little help:

 

"Create separate measures for the average, min and max and add them to one fields parameter"

 

So if I create a measure for the average, minimum, maximum, should that be? (final is my table name):

Avg Cycle time (days) = AVERAGE(final[Cycle time - DAYS]
Min Cycle time (days) = MINIMUM(final[Cycle time - DAYS]) 
Max Cycle time (days) = MAXIMUM(final[Cycle time - DAYS]) 
And then the same for Cycle time weeks and months?
 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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