Forum Discussion
If statement with year
Hi all,
this is the problem I am facing. I have 3 years, 2018, 2019 and 2020.
The formula I am using:
7 Replies
- AnonymousNot applicable
Why not create a calculated column in your table ?
CaseStudiesCalculated =
IF('2018-2019-2020_data'[Year]="2020",'2018-2019-2020_data'[Case studies])/0.67*'Case Study discount'[Case Study discount Value]/100),SUM('2018-2019-2020_data'[Case studies])
Then show the SUM of column in your visual
- rokas147Frequent Visitor
The problem is I cannot select '2018-2019-2020_data'[Year], thus the question is maybe I should be accessing this data somewhat different, I have tried uploading it as a string and as a numeric value. It didn't work both times
- rokas147Frequent Visitor
Thats the problem, when try using IF statement, it does not detect my "Year Column", therefore, it doesnt work
- AnonymousNot applicable
Show an example
- AnonymousNot applicable
Hi rokas147
Do you want to build a calculated column or a measure?
If you want to build a measure, use max function to get the Year value in '2018-2019-2020_data'.
If you want to build a calculated column, you use values from different tables. In which table do you want to build this calculated table, 'Case Study discount' or '2018-2019-2020_data'. If you want to build a calculated column in 'Case Study discount', you can't use Case studies and Year in '2018-2019-2020_data' directly, try to use related function to get the value.
You may refer to this blog for more details: Dax Error
If this reply still couldn't help you solve your problem, please share a sample with me by your Onedrive for Business.
And show a the result you want by screenshot. This will make it easier for me to understand your requirement.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi rokas147
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou
- rokas147Frequent Visitor
Lol, i just had to create a column instead of a measure, my faultsies boys and girls, apologize