Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am trying to make my first and last row value as zero . I used switch function to do it .
I have a parameter tenure with values 1 2 3 4 5 and forecasted parameter 2021,2022,2023,2024.......
If my tenure is 4 and forecasted year is 2022 then my 2022-4=2018 i.e value of forecasted year and value of year < 2018 should get zero.
so that i can take the sum of value from 2018+2019+2020+2021 from the table1.
newmeasure = selectedvalue[timeperiod]-tenure
new column =
var forecastedyear= year(today())+1
return
switch(true(),
year(sample[timeperiod].year = forecastedyear,0,
year(sample[timeperiod].year < newmeasure,0
return
table1
| Year | value | new column |
| 2017 | 1 | 1 |
| 2018 | 1 | 1 |
| 2019 | 1 | 1 |
| 2020 | 1 | 1 |
| 2021 | 1 | 1 |
| 2022 | 1 | 0 |
Problem in the dax is when i am passing the newmeasure in my new column dax it is making only forecasted value zero , but value less than year 2018 is still the same .
@Shahzz77 It's generally not advisable to use a measure as part of a calculated column. What happens in you column if you just simply return newmeasure?
if i am not using it as a colum then how do i select my slect my years to get considered ..what dax i have to write.. time period values how to slect
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 34 | |
| 32 | |
| 20 | |
| 12 | |
| 11 |