Forum Discussion

wangjuan303's avatar
wangjuan303
Helper III
4 years ago
Solved

How to create table base on slicer value

I have a dashboard, need to show detail data, that detail data in a big volume table, it is from DB2, and direct query connection,  and it has many to many relationship with other table, so I cannot create relationship for detail table for report performance, 

so my plan is 

1. use Direct query connect this table. 

2. in the Power bi use Dax create filtered table from this connection, 

3. then from this filtered table create detail report. 

 

now I am stuck on step 2, when filter table, related value from Slicer, 

How I create  filtered table base on Slicer value ? 

when I create table with hardcode,  like this way it works : 

 Filter Table = FILTER(
    DimProduct,
    DimProduct[Color]='Red' 
    &&
    DimProduct[SizeUnitMeasureCode]='CM')

 when I create table with slicer value, it will show blank, 

 Filter Table = 
Var Color = SELECTEDVALUE ('Color'[Color])
Var Code = SELECTEDVALUE ('Code'[Code])
Return
FILTER( DimProduct, DimProduct[Color]=Color && DimProduct[SizeUnitMeasureCode]=Code)

 Is this code have any error? or when we create table not allow to use dynamic filter? 

please give me any suggestion, Thank you 

2 Replies