Forum Discussion
Extract more than one value from a slicer
Hello! I need help with this dashboard. This dashboard is supposed to show our four main indicators (cycle time, lead time, deployed releases and Success rate) per quarter.
High management wants to compare the indicators in pairs, and they want to know the variability percentage of the two selected quarters (“Variación”, it’s a card placed on the line charts), so they can see if we are improving or decreasing our productivity and quality.
I have a Quarter (trimestre) slicer where they can select the quarters as they’d like (be mindful that these quarters are customized, they don’t follow Power BI’s hierarchy).
Right now since only two quarters are completed Q3 2024 and Q4 2024, the variability cards are fixed via different measures, but we need this to be dynamic, so whenever a pair of quarters is selected from the slicer, the variability card shows the respective percentage for those two quarters.
Does any of you have any idea of how this can be achieved? I have been trying and I know the SELECTEDVALUE() function might be the key, but I don’t know if it can catch two different values from the same slicer.
Any help and suggestions are appreciated!
Hi DannyVos93
Yes, you can definitely achieve this dynamically!
The idea is to create two separate measures:-
One for the first selected quarter
-
One for the second selected quarter
Then you can calculate the variation between them.
However, it’s important to note: if your slicer is based on a separate Quarter dimension table (which is the correct modeling practice), you must reference the quarter from that dimension table — not directly from your fact table — to avoid issues when no data exists for a selected quarter.
Here’s a safe and scalable approach:
-
Capture the minimum and maximum selected quarters from the Quarter dimension.
-
Create two measures, each filtered on one quarter.
-
Calculate the percentage variation between them.
Dax example :
Selected_Min_Quarter = MIN('Quarters'[Quarter])
Selected_Max_Quarter = MAX('Quarters'[Quarter])
Value_Min_Quarter =
CALCULATE(
[YourBaseMeasure],
FILTER(
ALL('Quarters'),
'Quarters'[Quarter] = [Selected_Min_Quarter]
)
)
Value_Max_Quarter =
CALCULATE(
[YourBaseMeasure],
FILTER(
ALL('Quarters'),
'Quarters'[Quarter] = [Selected_Max_Quarter]
)
)
Variation_Percentage =
DIVIDE(
(Value_Max_Quarter - Value_Min_Quarter),
Value_Min_Quarter,
0
)If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
-
6 Replies
- Ritaf1983
Super User
Hi DannyVos93
Yes, you can definitely achieve this dynamically!
The idea is to create two separate measures:-
One for the first selected quarter
-
One for the second selected quarter
Then you can calculate the variation between them.
However, it’s important to note: if your slicer is based on a separate Quarter dimension table (which is the correct modeling practice), you must reference the quarter from that dimension table — not directly from your fact table — to avoid issues when no data exists for a selected quarter.
Here’s a safe and scalable approach:
-
Capture the minimum and maximum selected quarters from the Quarter dimension.
-
Create two measures, each filtered on one quarter.
-
Calculate the percentage variation between them.
Dax example :
Selected_Min_Quarter = MIN('Quarters'[Quarter])
Selected_Max_Quarter = MAX('Quarters'[Quarter])
Value_Min_Quarter =
CALCULATE(
[YourBaseMeasure],
FILTER(
ALL('Quarters'),
'Quarters'[Quarter] = [Selected_Min_Quarter]
)
)
Value_Max_Quarter =
CALCULATE(
[YourBaseMeasure],
FILTER(
ALL('Quarters'),
'Quarters'[Quarter] = [Selected_Max_Quarter]
)
)
Variation_Percentage =
DIVIDE(
(Value_Max_Quarter - Value_Min_Quarter),
Value_Min_Quarter,
0
)If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
-
- AnonymousNot applicable
Hi DannyVos93 ,
Thank you for reaching out to the Microsoft Fabric Community.
I wanted to check if you had the opportunity to review the information provided by Ritaf1983 . Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.- DannyVos93Regular Visitor
Hello! Thank you for following up.
Yesterday I tried the suggested solution and unfortunately it worked partially, I am able to properly catch the values of the quarters, but it is not properly calculating the values of my KPIs, in the screenshot below, you can see that it gets the same value, 58.20, when it should be 41.76 and 82.16, respectively.
I do have to mention that, I did not have a Quarters table, but I did have a Calendar table with the respective Quarter and a QuarterOrder columns. However, I created the Quarters table and connected it to the Calendar table, I don't know if it was unnecessary. I tried using the Quarters field directly from the Calendar column and got similar results.Is there anything I'm missing out here?
- Ritaf1983
Super User
Hi DannyVos93
Unfortunately, I can't provide a more detailed solution without access to your file.
Based on the general information you provided, the solution I shared should work without the need for an additional quarters table, assuming your calendar table includes a quarter column.
To assist further, I would need access to your data model.
Please create a small dataset that reflects the structure of your model with only the relevant data, and share it via any public cloud service.
Also, include an example of the expected result.
Without these, it's not possible to provide support beyond what I’ve already shared.