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
Nazdac911
Helper II
Helper II

Depends of chosen slicers values , show the table of comparison

Hi all

I have the following flat table which consist of 4 simple columns:

continent, City, Product category, sales

Nazdac911_0-1670251106073.png

 

I want to use a slicer for City column and compare product categories sales for "only two cities"beside each other and calculate the delta
so the resulted table will be simillar like this, 

Nazdac911_1-1670251130740.png

 

Is this possible ?? 
Extra challenge: can I make the Matrix column headers equal to the chosen slicer values. 
Thanks in adavnce 
regards 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Nazdac911 , You can have meausre like

 

//Date1 is independent Date table
new measure =
var _max = maxx(allselected(city),city[city])
var _min = minx(allselected(city),city[city])
return

if(isinscope(city[city]) , [measure],
calculate([Measure], filter('city', 'city'[city] =_max )) -calculate([Measure], filter('city', 'city'[city] =_min )) )

 

isinscope will move delta to column grand total of matrix column

 

 

another approach

 

Compare Categorical Data Using Slicers - Compare two Brands: https://youtu.be/exN4nTewgbc

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Nazdac911 , You can have meausre like

 

//Date1 is independent Date table
new measure =
var _max = maxx(allselected(city),city[city])
var _min = minx(allselected(city),city[city])
return

if(isinscope(city[city]) , [measure],
calculate([Measure], filter('city', 'city'[city] =_max )) -calculate([Measure], filter('city', 'city'[city] =_min )) )

 

isinscope will move delta to column grand total of matrix column

 

 

another approach

 

Compare Categorical Data Using Slicers - Compare two Brands: https://youtu.be/exN4nTewgbc

As expected always  from you 

Thank you for the great solution 🙂 

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.