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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
KC_MS
Frequent Visitor

use the selectedvalue of a slicer from a disconnect table to filter data in another table and chart

new to power bi and need some help~

i have 2 tables, simplified as below

tbl_RE

KC_MS_0-1718730367077.png

tbl_hierarchy

KC_MS_1-1718730400214.png

what i'm trying to do is to create sth like this 

KC_MS_2-1718730450402.png

the left is a slicer base on tbl_hierarchy, middle and right is data table and chart both based on data from tbl_RE
when user pick a value from the slicer (let say Entity 1), the table and the chart should refresh accodingly to include only records related to Entity 1.
Another thing here is "Groupwide" actually means all entities under the group and "ALL APAC" means all entities in APAC, so no matter which entity the user selected, these 2 should be included.

so if user picked Entity 1 from the slicer, the table should refresh to only show RE1, RE3, RE4 and RE5 and the chart should also be refresh to only include show RE1, RE3, RE4 and RE5.

 

i tried to create a measure to filter the table, which "seems" work on filtering the table but it doesn't work on the chart...

 

appreciate if anyone could help~~ Thx

 

 

P.S. i know it's much better to provide sample workable data and i created a pibx. but my IT guy did a good job to block all the online storage i know... so sorry for the inconvenience

 



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

Hi,@KC_MS 
I am glad to help you.

You can refer to my test results below, where I labeled the data by creating a measure and filtered the data by the value of the measure, while the slicer was only used to pass in the filtering criteria, and had no filtering functionality of its own

here is my DAX code:

M_ =

VAR selected_=SELECTCOLUMNS('tbl_hierarchy','tbl_hierarchy'[Name])

VAR selected_oneValue=SELECTEDVALUE('tbl_hierarchy'[Name])

VAR table_value=MAX('tbl_RE'[Impacted_Entities])

VAR result_=

IF(MAX('tbl_RE'[Impacted_Entities])IN selected_ ||MAX('tbl_RE'[Impacted_Entities])="ALL APAC"||MAX('tbl_RE'[Impacted_Entities])="Groupwide",

1,0)

RETURN

SWITCH(TRUE(),

result_=1,1,

CONTAINSSTRING(table_value,selected_oneValue),1,

0

)

vjtianmsft_0-1718764920211.png

 

Add a filter of M_=1 to both visual "filter" fields.

vjtianmsft_1-1718764938533.pngvjtianmsft_2-1718764946343.pngvjtianmsft_3-1718764957005.pngvjtianmsft_4-1718764968568.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

2 REPLIES 2
v-jtian-msft
Community Support
Community Support

Hi,@KC_MS 
I am glad to help you.

You can refer to my test results below, where I labeled the data by creating a measure and filtered the data by the value of the measure, while the slicer was only used to pass in the filtering criteria, and had no filtering functionality of its own

here is my DAX code:

M_ =

VAR selected_=SELECTCOLUMNS('tbl_hierarchy','tbl_hierarchy'[Name])

VAR selected_oneValue=SELECTEDVALUE('tbl_hierarchy'[Name])

VAR table_value=MAX('tbl_RE'[Impacted_Entities])

VAR result_=

IF(MAX('tbl_RE'[Impacted_Entities])IN selected_ ||MAX('tbl_RE'[Impacted_Entities])="ALL APAC"||MAX('tbl_RE'[Impacted_Entities])="Groupwide",

1,0)

RETURN

SWITCH(TRUE(),

result_=1,1,

CONTAINSSTRING(table_value,selected_oneValue),1,

0

)

vjtianmsft_0-1718764920211.png

 

Add a filter of M_=1 to both visual "filter" fields.

vjtianmsft_1-1718764938533.pngvjtianmsft_2-1718764946343.pngvjtianmsft_3-1718764957005.pngvjtianmsft_4-1718764968568.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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



thx @v-jtian-msft ~
it works perfect~

if you have some spare time and if you don't mind, can you explain a bit more on your DAX code and how it works?
especially on those "MAX" which i don't quite get what it does here and the purpose?

on a side note, what if i want to allow user to select multiple entities from the slicers?

 

thanks again for your help~

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.