Forum Discussion
Dynamic column values based on selected date
- 2 years ago
Hi msam86 - I have checked as per sample data shared, can you please use the below dax logic
create a parameter with numeric range, and specify the year values from 2023 to 2026 with increment 1
Dynamic Status =VAR SelectedYear = SELECTEDVALUE('Current Year'[Current Year])RETURNSWITCH(TRUE(),'Testingdata'[Year] < SelectedYear, "Down",'Testingdata'[Year] = SelectedYear, "Attention",'Testingdata'[Year] > SelectedYear, "Up",'Testingdata'[Status] -- Default to the original status if no condition matches)Ensure the parameter and calculated column are correctly named and referenced in your DAX formula.Adjust the range of years in the parameter to match your dataset.Test the functionality by selecting different years in the slicer and verifying the output in your table visual.Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!! - Anonymous2 years ago
Hi rajendraongole1 ,thanks for the quick reply, I'll add further.
Hi msam86 ,
The Table data is shown below:
Please follow these steps:
1. Create a parameter with numeric range
2.Use the following DAX expression to create a measure(Be careful not to create calculated columns)
Measure = VAR SelectedYear = SELECTEDVALUE('Current Year'[Current Year]) RETURN SWITCH( TRUE(), YEAR(MAX('Table'[YEAR])) < SelectedYear, "Down", YEAR(MAX('Table'[YEAR])) = SelectedYear, "Attention", YEAR(MAX('Table'[YEAR])) > SelectedYear, "Up", MAX('Table'[Status]) -- Default to the original status if no condition matches )3.Final output
Details can be found in the .pbix file. If the problem is solved, please mark rajendraongole1 and I as the solution.
Hi rajendraongole1 ,thanks for the quick reply, I'll add further.
Hi msam86 ,
The Table data is shown below:
Please follow these steps:
1. Create a parameter with numeric range
2.Use the following DAX expression to create a measure(Be careful not to create calculated columns)
Measure =
VAR SelectedYear = SELECTEDVALUE('Current Year'[Current Year])
RETURN
SWITCH(
TRUE(),
YEAR(MAX('Table'[YEAR])) < SelectedYear, "Down",
YEAR(MAX('Table'[YEAR])) = SelectedYear, "Attention",
YEAR(MAX('Table'[YEAR])) > SelectedYear, "Up",
MAX('Table'[Status]) -- Default to the original status if no condition matches
)
3.Final output
Details can be found in the .pbix file. If the problem is solved, please mark rajendraongole1 and I as the solution.
Thanks a lot for the help!!! Amazing how power bi works!
Anonymous Did you have the xls file?
Regards
- Anonymous2 years agoNot applicable