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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ravi_609
Helper I
Helper I

How to Compare Two Column Dynamically?

I want to compare custom column with Fiscal Year.

when I have set Filter in Slicer "Sales Period" & Compare with any year data with Slicer "Compare To".

 

I can not get any solution to make it working.Help me out if anyone knows the solution. 

Image is just for the reference.

Custom Compare.png

 

Here is my data set below:-

DataSet.png

2 ACCEPTED SOLUTIONS
ravi_609
Helper I
Helper I

 @amitchandak 
Hello Sir, I have got the solution
Your solution is nearby same but with the relation of two date table my slicer also filtered.

So I have create Two table with My financial Year column 

First Table Name =Compare From
Second Table Name = Compare To

 

Compare From = VALUES(Financials[Financial Year])

 

Then Second

Compare To = VALUES(Financials[Financial Year])

 

Then we create one measure for remove same selected value from other slicer

So the measure for this 

FY Selection Control = IF(SELECTEDVALUE('Compare From'[From Financial Year]) = SELECTEDVALUE('Compare To'[To Financial Year]),0,1)

 

Then apply this measure in visual level filter & set value to "1".

 

 

Then Create Two measure for Calculate Sales :

From Sales = CALCULATE([Total Sales],FILTER(Financials, Financials[Financial Year] IN {SELECTEDVALUE('Compare From'[From Financial Year])}))​

 

To Sales = CALCULATE([Total Sales],FILTER(Financials, Financials[Financial Year] IN {SELECTEDVALUE('Compare To'[To Financial Year])}))​

 

Then apply this two measure in your visual.

 

View solution in original post

ravi_609
Helper I
Helper I

Here is the screenshot for the flow:

Two new tables unrelated to any other table in the model.

Screenshot (107).png

Create like this :

Screenshot (108).png

Screenshot (109).png

The selection filter is then applied at the visual level as follows:

Screenshot (110).png

The last sales measure is then applied to the visual.

Here's the last output:

Screenshot (111).png

View solution in original post

5 REPLIES 5
ravi_609
Helper I
Helper I

Here is the screenshot for the flow:

Two new tables unrelated to any other table in the model.

Screenshot (107).png

Create like this :

Screenshot (108).png

Screenshot (109).png

The selection filter is then applied at the visual level as follows:

Screenshot (110).png

The last sales measure is then applied to the visual.

Here's the last output:

Screenshot (111).png

ravi_609
Helper I
Helper I

 @amitchandak 
Hello Sir, I have got the solution
Your solution is nearby same but with the relation of two date table my slicer also filtered.

So I have create Two table with My financial Year column 

First Table Name =Compare From
Second Table Name = Compare To

 

Compare From = VALUES(Financials[Financial Year])

 

Then Second

Compare To = VALUES(Financials[Financial Year])

 

Then we create one measure for remove same selected value from other slicer

So the measure for this 

FY Selection Control = IF(SELECTEDVALUE('Compare From'[From Financial Year]) = SELECTEDVALUE('Compare To'[To Financial Year]),0,1)

 

Then apply this measure in visual level filter & set value to "1".

 

 

Then Create Two measure for Calculate Sales :

From Sales = CALCULATE([Total Sales],FILTER(Financials, Financials[Financial Year] IN {SELECTEDVALUE('Compare From'[From Financial Year])}))​

 

To Sales = CALCULATE([Total Sales],FILTER(Financials, Financials[Financial Year] IN {SELECTEDVALUE('Compare To'[To Financial Year])}))​

 

Then apply this two measure in your visual.

 

amitchandak
Super User
Super User

@ravi_609 , yes , you should be .

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
ravi_609
Helper I
Helper I

@amitchandak Thank you so much for the quick response.

Can i give relationship of second Calendar table with Financial Table?

amitchandak
Super User
Super User

@ravi_609 , if you need two slicer , you need two date table. I have done for two date range. You can do for FY

https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

Refer if needed

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors