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
Hi
I am new to DAX , can you please help to write down an IF statement that described by the below :
Using IF statements to decide if the year is 2022, month is 36 else 48
Thanks
Solved! Go to Solution.
Hi @HishamAT
Tis is not the end result right? But I can give you some ideas based on your input.
This i my base data with the table called BaseTable:
1) Example with calculated column
Calculated Column Example = IF([Year]=2022,36,48)
Now with a measure:
Measure Example =
IF(MAX(BaseTable[Year])=2022,36,48)Is this what you are looking for? If not please provide an end-2-end problem startement from data source to calculation to visual.
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
Hi @HishamAT
Tis is not the end result right? But I can give you some ideas based on your input.
This i my base data with the table called BaseTable:
1) Example with calculated column
Calculated Column Example = IF([Year]=2022,36,48)
Now with a measure:
Measure Example =
IF(MAX(BaseTable[Year])=2022,36,48)Is this what you are looking for? If not please provide an end-2-end problem startement from data source to calculation to visual.
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
Hi @HishamAT
Can you please provide more context, e.g. the data model, sample data as well as explanation what you want to have as an output (Do you want the result to be shown in a calculated column? in a visual? what kind of visual?)
if it is a calculate column then it would be IF([year] = 2022,36,48)
But I have the feeling that this will not help you in the end.
Best regards
Michael
I have a table of Date, contains a year column:
| Year | Month |
| 2018 | 2 |
| 2019 | 3 |
| 2020 | 4 |
| 2021 | 5 |
| 2022 | 6 |
and i need return a measure field that if have the value of the 2022 = 36
else a measure field that have the value of the 2023 = 48
Thanks
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 36 | |
| 34 | |
| 31 | |
| 27 |
| User | Count |
|---|---|
| 135 | |
| 103 | |
| 65 | |
| 61 | |
| 55 |