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

Based on Slicer Selections data should be show (Strings)

Hi Experts,
Please help me with the below scenario.
I want to display a different level of data in a table visual, 

Slicer Sel =
var A = FIRSTNONBLANK('Region Table'[Comments],COUNT('Regiont Table'[Comments]))
var B = FIRSTNONBLANK('Unit Table'[Comments],COUNT('Unit Table'[Comments]))
var C = FIRSTNONBLANK('Global table '[Comments],COUNT('Global table '[Comments]))

var D = IF(ISFILTERED('Dim Region'[Unit]),B,IF (ISFILTERED('Dim Region'[Region]),A,IF(ISFILTERED('Dim Region'),C)))
return
D


1.If I  am selecting a region in the slicer 
Expecting Out put:  Region table Test data should be displayed in the table visual 
2.If I  am selecting a Unit in the slicer 
Expecting Out put: Unit table Test data should be displayed in the table visual 
3.If I  am not  selecting anything in the slicer 
Expecting Out put : Global table Test data should be displayed in the table visual 


Example 
I have three tables 
Region table:

RegionLine ItemTest data
Americamachine'ssales good 
Europefashionavarge

Unit table:

unitLine itemtest data
clombiomachine'sTest_1
North americafashionTest_2

Global table:

Line ItemTest data
machine'sMachine are good compared to region sale's
fashionHigh sales


i am getting only region level and unit level test data but not getting global level test data (means not filttering anything in the slicer ) please help me on this.
Regards,
Chanti

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

Hi @filexsundeep09 

You can refer to the following example.

1.Create a new table, the information is as follows:

vxinruzhumsft_0-1673941869453.png

 

2.Create a measure:

Measure = var _add1 = ADDCOLUMNS(ALLSELECTED('Global table'),"Rank",RANKX(ALLSELECTED('Global table'),[Line Item],,ASC,Dense))
var _add2=ADDCOLUMNS(ALLSELECTED(Region),"Rank",RANKX(ALLSELECTED(Region),[Region],,ASC,Dense))
var _add3=ADDCOLUMNS(ALLSELECTED(Unit),"Rank",RANKX(ALLSELECTED(Unit),[unit],,ASC,Dense))
return SWITCH(TRUE(),ISFILTERED(Unit[unit])=FALSE()&&ISFILTERED(Region[Region])=FALSE(),MAXX(FILTER(_add1,[Rank]=MAX('Row'[Row])),[Test data]),ISFILTERED(Unit[unit]),MAXX(FILTER(_add3,[Rank]=MAX('Row'[Row])),[test data]),ISFILTERED(Region[Region]),MAXX(FILTER(_add2,[Rank]=MAX('Row'[Row])),[Test data]))

Then put the "Row" column and measure to the table visual.

Output:

vxinruzhumsft_1-1673941979800.png

 

vxinruzhumsft_2-1673942004836.png

Best Regards!

Yolo Zhu

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

1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Hi @filexsundeep09 

You can refer to the following example.

1.Create a new table, the information is as follows:

vxinruzhumsft_0-1673941869453.png

 

2.Create a measure:

Measure = var _add1 = ADDCOLUMNS(ALLSELECTED('Global table'),"Rank",RANKX(ALLSELECTED('Global table'),[Line Item],,ASC,Dense))
var _add2=ADDCOLUMNS(ALLSELECTED(Region),"Rank",RANKX(ALLSELECTED(Region),[Region],,ASC,Dense))
var _add3=ADDCOLUMNS(ALLSELECTED(Unit),"Rank",RANKX(ALLSELECTED(Unit),[unit],,ASC,Dense))
return SWITCH(TRUE(),ISFILTERED(Unit[unit])=FALSE()&&ISFILTERED(Region[Region])=FALSE(),MAXX(FILTER(_add1,[Rank]=MAX('Row'[Row])),[Test data]),ISFILTERED(Unit[unit]),MAXX(FILTER(_add3,[Rank]=MAX('Row'[Row])),[test data]),ISFILTERED(Region[Region]),MAXX(FILTER(_add2,[Rank]=MAX('Row'[Row])),[Test data]))

Then put the "Row" column and measure to the table visual.

Output:

vxinruzhumsft_1-1673941979800.png

 

vxinruzhumsft_2-1673942004836.png

Best Regards!

Yolo Zhu

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.