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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tabi786
Regular Visitor

Select Column Value based on Slicer Selection

Hi,

 

I have following two tables Budgets and Years. On selected value of Years, I want to show the selected year budget in Selected Budget field.

 

Selected Year is Measure Field like below and it works fine.

Selected Year = SELECTEDVALUE(Years[Year]; 0)

 

Selected Budget is a Calculated Field like below but this doesn't work:

Selected Budget = IF([Selected Year] = 2017; Budgets[Budget 2017]; IF([Selected Year] = 2018; Budgets[Budget 2018];IF([Selected Year] = 2019; Budgets[Budget 2019]; IF([Selected Year] = 2020; Budgets[Budget 2020];IF([Selected Year] = 2021;Budgets[Budget 2021];IF([Selected Year] = 2022;Budgets[Budget 2022];0)))))) 

 

Do I need to create Measure Column instead of Calculated column? If yes, what would be the fomular?

 

 

Regards.

 

Aftab Ahmad

 

Power BI

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Yes, you need a measure, calculated columns are only calculated at data load and are not dynamic. You could use the same formula and just wrap a MAX around each of your Budgets[Budget 2017], etc. columns. That being said, you would have an easier time if you perhaps unpivoted your budget columns and assigned them a year, then you could do it with a FILTER statement.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
tabi786
Regular Visitor

Hi,

 

I have following two tables Budgets and Years. On selected value of Years, I want to show the selected year budget in Selected Budget field.

 

Selected Year is Measure Field like below and it works fine.

Selected Year = SELECTEDVALUE(Years[Year]; 0)

 

Selected Budget is a Calculated Field like below but this doesn't work:

Selected Budget = IF([Selected Year] = 2017; Budgets[Budget 2017]; IF([Selected Year] = 2018; Budgets[Budget 2018];IF([Selected Year] = 2019; Budgets[Budget 2019]; IF([Selected Year] = 2020; Budgets[Budget 2020];IF([Selected Year] = 2021;Budgets[Budget 2021];IF([Selected Year] = 2022;Budgets[Budget 2022];0)))))) 

 

Do I need to create Measure Column instead of Calculated column? If yes, what would be the fomular?

 

 

Regards.

 

Aftab Ahmad

 

Power BI

Greg_Deckler
Community Champion
Community Champion

Yes, you need a measure, calculated columns are only calculated at data load and are not dynamic. You could use the same formula and just wrap a MAX around each of your Budgets[Budget 2017], etc. columns. That being said, you would have an easier time if you perhaps unpivoted your budget columns and assigned them a year, then you could do it with a FILTER statement.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.