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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
uk17487
Frequent Visitor

DAX Formula Help Needed - Retrive Non Slicer Values having same Measure Value as Slicer Value

Hello All,

 

We have a table in PBI with two columns C1 and C2 having data as below

C1 C2

1    A

1    B

2    B

2    C

3    C

3    D

4    D

4    A

 

Requirement -  Using a single select slicer on column C2, for a selected value, it is required to display all values from C2 that have same value of C1 except the slicer value.

 

Example :

If C2=A is selected in slicer, then B and D should be displayed as both have same C1 value (1,4) as A

If C2=D is selected in slicer, then C and A should be displayed as both have same C1 value (3,4) as C

 

We have to implement this in DAX. Request to please help or provide an approach. 

 

Thanks

Uday

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @uk17487 

For your requirement, you could try this way:

Step1:

Add a fact C2 table as a slicer, (you could not use original C2 as a slicer)

Step2:

Use this formula to create a measure

Measure = VAR _table=CALCULATETABLE(VALUES('Table'[C1]),FILTER(ALLSELECTED('Table'),'Table'[C2] = SELECTEDVALUE(C2[C2]))) return
CALCULATE(MAX('Table'[C2]),FILTER('Table','Table'[C1] IN _table))

Step3:

Drag this measure into visual level filter and set is not blank

Result:

7.JPG8.JPG

and here is pbix file, please try it.

 

Best Regards,

Lin

 

Community Support Team _ Lin
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

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi, @uk17487 

For your requirement, you could try this way:

Step1:

Add a fact C2 table as a slicer, (you could not use original C2 as a slicer)

Step2:

Use this formula to create a measure

Measure = VAR _table=CALCULATETABLE(VALUES('Table'[C1]),FILTER(ALLSELECTED('Table'),'Table'[C2] = SELECTEDVALUE(C2[C2]))) return
CALCULATE(MAX('Table'[C2]),FILTER('Table','Table'[C1] IN _table))

Step3:

Drag this measure into visual level filter and set is not blank

Result:

7.JPG8.JPG

and here is pbix file, please try it.

 

Best Regards,

Lin

 

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

Hi Lin,

 

It worked perfectly.

Thanks for your help.

 

Hi,

 

If the main table is going to be connected to other supporting tables and the reports had to be created using the slicer of the main table column C2, then what do we tweak in the current solution to handle the same. As in current solution, we are using C2 table as the slicer and not the main table column. My apologies I did not forsee that model can have more than one table. Kindly advise.

 

Please let me know if I should start a new post.

 

Thanks

Uday

hi, @uk17487 

Just for your current requirement(Retrive Non Slicer Values having same Measure Value as Slicer Value), It could not use the main table column C2 as a slicer.

And for your other requirement, you could share your sample report for us to have a test or start a new post and add the other conditional.

 

Best Regards,

Lin

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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