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
harshadrokade
Post Partisan
Post Partisan

Changing data set for a visual based on slicer

I have mentojned below a sample dummy data. I have these two seperate tables

 

YearSegmentLocalityLocality score
2010PQRUSAA
2011XYZUKD
2012ABCChinaC

 

YearSegmentSegment score
2010PQRB
2011XYZD
2012ABCC

 

I have three slicers as Year, Segment & Locality. I have a card visual as 'Score'. 

This visual should have Locality score if specific Locality is selected in Locality slicer however if 'All' is selected in Locality slicer, the same visual should show Segment score as there is no specific Locality selected & now we want Segment level data. 

 

Example- 

If Segment slicer has value as PQR selected & Locality slicer has value selected as USA- Card visual will show value as 'A' which is of Locality as USA

If Segment slicer has value as PQR selected & Locality slicer has value selected as All- Same Card visual will show value as 'B' which is of Segment as PQR

 

Pls help.

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @harshadrokade 

Try this.

Create the measure:

Measure =
  var _Seg= SELECTEDVALUE(SegSlicer[Segment])
  var _SegScore= CALCULATE(SELECTEDVALUE(Table2[Segment score]),Table2[Segment]=_Seg)
  var _Loc= SELECTEDVALUE(LocSlicer[Locality])
  var _LocScore= CALCULATE(SELECTEDVALUE(Table1[Locality score]),Table1[Locality]=_Loc)
return
  IF(ISBLANK(_Loc),_SegScore,_LocScore)

Result:

v-xiaotang_0-1621335938478.png

v-xiaotang_1-1621335938481.png

See sample file attached below.

 

Best Regards,

Community Support Team _ Tang

If this post helps, 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-xiaotang
Community Support
Community Support

Hi @harshadrokade 

Try this.

Create the measure:

Measure =
  var _Seg= SELECTEDVALUE(SegSlicer[Segment])
  var _SegScore= CALCULATE(SELECTEDVALUE(Table2[Segment score]),Table2[Segment]=_Seg)
  var _Loc= SELECTEDVALUE(LocSlicer[Locality])
  var _LocScore= CALCULATE(SELECTEDVALUE(Table1[Locality score]),Table1[Locality]=_Loc)
return
  IF(ISBLANK(_Loc),_SegScore,_LocScore)

Result:

v-xiaotang_0-1621335938478.png

v-xiaotang_1-1621335938481.png

See sample file attached below.

 

Best Regards,

Community Support Team _ Tang

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

Thanks a lot for all your help sir. Very much appreciate your help

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.