cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Solution Supplier
Solution Supplier

DAX to fetch values from two slicers on same column

Hi,

I have have a column with quarters and year in the format "2019/Q3".

I want to have 2 different slicers on this column so that i can compare results across these 2 quarters selected.

The hurdle for me is fetch individual values from these 2 slicers. I tried using selectedvalue but it does not work. It would be great if someone can help me here.

e.g if selected value in slicer 1 is "2019/Q3" and selected value in slicer 2 is "2019/Q4", then i need 2 measures with these 2 values as result.

Note: the slicers are based on the same column in a table

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @vaibhavdesai,

When making more tahn one slicer on the sam column you will get the information from tue slicers filtered by the selection of the others since the slicers work for filtering the data so you will get subsets of your data.

Based on your requirement you ca do one of two things:

Create a single slicer that allows you to select more than 1 value and then using the MAX and MIN function get the highest and lowest value on the slicer and use those for your measures. Be aware that you would probably also need to add a measure to warn when user selects more than two values.

Other option is to create two separet tables fo the slicers (without relationship) to the the column you need to filter and then using th selecred value for eaxh of the slicers create you measures.

Regard,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

4 REPLIES 4
Super User I
Super User I

I suggest you to turn on the interaction of the slicers for the desired tables only.

You can see the edit interactions on Format Tab once you clicked the slicer tab





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks, but I don't want to display them as visuals. I need those 2 values as 2 separate measures as I will be using them to calculate some other metrics in the report.
Super User III
Super User III

Hi @vaibhavdesai,

When making more tahn one slicer on the sam column you will get the information from tue slicers filtered by the selection of the others since the slicers work for filtering the data so you will get subsets of your data.

Based on your requirement you ca do one of two things:

Create a single slicer that allows you to select more than 1 value and then using the MAX and MIN function get the highest and lowest value on the slicer and use those for your measures. Be aware that you would probably also need to add a measure to warn when user selects more than two values.

Other option is to create two separet tables fo the slicers (without relationship) to the the column you need to filter and then using th selecred value for eaxh of the slicers create you measures.

Regard,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

Community Support
Community Support

Hi @vaibhavdesai ,

You need to create new irrelevant tables as slicers. If use the original column, the results will be always filtering by another slicer.I create a sample that you could have a try.

  • Create a column in original table
Year & Quarter = 'Table'[Date].[Year]&"/Q"&'Table'[Date].[QuarterNo]
  •  Create two new tables

1.PNG

  • Create two measures
Q3 = 
VAR a =
    SELECTEDVALUE ( '2019/Q3'[2019/Q3] )
VAR b =
    CALCULATE (
        SUM ( 'Table'[ Sales] ),
        FILTER ( 'Table', 'Table'[Year & Quarter] = a )
    )
RETURN
    IF ( ISFILTERED ( '2019/Q3'[2019/Q3] ), b, BLANK () )

Q4 = 
VAR a =
    SELECTEDVALUE ( '2019/Q4'[2019/Q4] )
VAR b =
    CALCULATE (
        SUM ( 'Table'[ Sales] ),
        FILTER ( 'Table', 'Table'[Year & Quarter] = a )
    )
RETURN
    IF ( ISFILTERED ( '2019/Q4'[2019/Q4] ), b, BLANK () )

2.PNG3.PNG

Best Regards,

Xue Ding

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

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

Helpful resources

Announcements
November Update

Check it Out!

Click here to read more about the November 2020 Updates!

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform October Community Highlights

Check out the top community contributors across all of the communities

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors