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
Pri
Frequent Visitor

One slicer from two different tables

I have two tables as shown in below image. Where table1 one has some column along with a field Total Value and another table has somef fields along with the field Internal Value. Now, I want to create a slicer which filters based on : Total Value, External Value and Internal Value where External Value = Total Value - Internal Value.

 

Can someone please look into this asap.

 

Many thanks

Regards

 

 

Capture3.png

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Pri , re-read this post. Not sure but this seems like a use case for the disconnected table trick. In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick....

 

Attached a PBIX with a possible solution. You want the TotalValues, InternalValues and Slicer tables. The measure is:

 

Measure = 
VAR __measure = MAX('Slicer'[Column1])
RETURN
    SWITCH(TRUE(),
        __measure = "Total Value",SUM('TotalValues'[Total Value]),
        __measure = "Internal Value",SUM('InternalValues'[InternalValue]),
        __measure = "External Value",SUM('TotalValues'[Total Value]) - SUM('InternalValues'[InternalValue]),
        -1
    )

Critically, this assumes that your two tables are related in some fashion. If not, you will have to use LOOKUPVALUE or something along those lines to relate the Total Value to the Internal Value.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

@Pri , re-read this post. Not sure but this seems like a use case for the disconnected table trick. In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick....

 

Attached a PBIX with a possible solution. You want the TotalValues, InternalValues and Slicer tables. The measure is:

 

Measure = 
VAR __measure = MAX('Slicer'[Column1])
RETURN
    SWITCH(TRUE(),
        __measure = "Total Value",SUM('TotalValues'[Total Value]),
        __measure = "Internal Value",SUM('InternalValues'[InternalValue]),
        __measure = "External Value",SUM('TotalValues'[Total Value]) - SUM('InternalValues'[InternalValue]),
        -1
    )

Critically, this assumes that your two tables are related in some fashion. If not, you will have to use LOOKUPVALUE or something along those lines to relate the Total Value to the Internal Value.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler : In addition to the above, I have following measures which were earlier working on Total Value column, however these now need to be dynamic based on the slicer selection.

 

CY = SUMX(FILTER(Query1,Query1[Year_Label] = "CY"),Query1[Total Value])
PY = SUMX(FILTER(Query1,Query1[Year_Label] = "PY"),Query1[Total Value])
 
I did try to replace it with the new measure as below but it doesn't work.
 
PY = SUMX(FILTER(Query1,Query1[Year_Label] = "PY"),[Measure])
 
 
Regards

Thanks a lot. This works perfectly fine. 🙂
Greg_Deckler
Community Champion
Community Champion

I would suggest creating a calculated column that performs that calculation and returns 0 and 1 or true/false, etc. depending upon the outcome. Then use that column as your slicer.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Can you please share the complete formula?

 

@Greg_Deckler 

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.

Top Kudoed Authors