Forum Discussion
Pablo_Quintana
5 years agoFrequent Visitor
IF + query problem
Hi everyone, I have tried a lot of previous solutions I have found to this issue but I'm not being able to solve the IF problem 1. Recode birth year into age by 2020 - age : Age = IF(BYear = Bl...
- 5 years ago
Hi Pablo_Quintana ,
You can make this on the query editor or adding a column in DAX:
Power Query:groupin
if [BYear] = null then null else (2020- [BYear])DAX:
Column = IF('Table'[BYear] = BLANK();BLANK();2020 - 'Table'[BYear])Then you can make a group or new column wiht the following syntax:
Column 2 = SWITCH(TRUE();'Table'[Age] = BLANK();BLANK(); 'Table'[Age] < 35; "<35 Years"; 'Table'[Age] < 45 && 'Table'[Age] > 35; "Between 35 and 45 years";">45")
amitchandak
5 years agoSuper User
Pablo_Quintana , Try like
Age = IF( isblank([BYear]) , blank(), (2020 - [BYear]))
Switch ( True(),
[Age] < 35, "<35 Years",
[Age] < 45, "Between 35 and 45 years"
,">45")