Forum Discussion
pk1593
3 years agoHelper I
DAX Code Help
I have a sample data with Survey waves (from 5 different time periods 1 to 5). Need help in creating the below 3 columns highlighted in green. 1. Latest Wave column: Need to create a new column i...
- 3 years ago
Hi,
Here is one way to do this:
Data:Dax:
Latest =var _max = MAX('Table (35)'[survey_wave]) returnIF('Table (35)'[survey_wave] = _max,1,0)
2. Latest =var _max = MAX('Table (35)'[survey_wave])-1 returnIF('Table (35)'[survey_wave] = _max,1,0)
top 3 =var _max = MAX('Table (35)'[survey_wave])-2 returnIF('Table (35)'[survey_wave] >= _max,1,0)
Test (added data):
End result:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
ValtteriN
3 years agoCommunity Champion
Hi,
Here is one way to do this:
Data:
Dax:
Latest =
var _max = MAX('Table (35)'[survey_wave]) return
IF('Table (35)'[survey_wave] = _max,1,0)
2. Latest =
2. Latest =
var _max = MAX('Table (35)'[survey_wave])-1 return
IF('Table (35)'[survey_wave] = _max,1,0)
top 3 =
Test (added data):
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
top 3 =
var _max = MAX('Table (35)'[survey_wave])-2 return
IF('Table (35)'[survey_wave] >= _max,1,0)
Test (added data):
End result:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/