Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello, Hoping you can help me with solving my two problems below.
Problem One- Write these two statements in DAX- I copy and pasted what I use in Alteryx
2019 Outlet Status
If DateTimeYear([Outlet Max_Week Ending])=2018 then "Lost"
elseif DateTimeYear([Outlet Min_Week Ending])=2019 then "New"
elseif DateTimeYear([Outlet Min_Week Ending])= 2020 then "Other"
else "Active"
endif
2020 Outlet Status
If DateTimeYear([Outlet Max_Week Ending])=2019 Then "Lost"
elseif DateTimeYear([Outlet Min_Week Ending])=2020 then "New"
elseif DateTimeYear([Outlet Max_Week Ending])=2018 then "Other"
else "Active"
endif
Problem Two -Switch between the two variables above depending on the Slicer Selection
Solved! Go to Solution.
@Anonymous
You need to write the DAX version as follows for the first problem, I hope they are added as a calculated column.
2nd Problem is Measure I believe. You can adapt in the same way. I need more clarification on the second one, better if you could attach a sample PBIX file.
2019 Outlet Status =
SWITCH( TRUE() ,
DateTimeYear[Outlet Max_Week Ending] = 2018, "Lost",
DateTimeYear[Outlet Min_Week Ending] = 2019, "New",
DateTimeYear[Outlet Min_Week Ending] = 2020, "Other",
"Active"
)
2020 Outlet Status =
SWITCH( TRUE(),
DateTimeYear[Outlet Max_Week Ending] = 2019, "Lost",
DateTimeYear[Outlet Min_Week Ending] = 2020, "New",
DateTimeYear[Outlet Max_Week Ending] = 2018, "Other",
"Active"
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Anonymous - Don't use nested IF ELSE statements, use SWITCH() or SWITCH(TRUE()...)
@Anonymous
You need to write the DAX version as follows for the first problem, I hope they are added as a calculated column.
2nd Problem is Measure I believe. You can adapt in the same way. I need more clarification on the second one, better if you could attach a sample PBIX file.
2019 Outlet Status =
SWITCH( TRUE() ,
DateTimeYear[Outlet Max_Week Ending] = 2018, "Lost",
DateTimeYear[Outlet Min_Week Ending] = 2019, "New",
DateTimeYear[Outlet Min_Week Ending] = 2020, "Other",
"Active"
)
2020 Outlet Status =
SWITCH( TRUE(),
DateTimeYear[Outlet Max_Week Ending] = 2019, "Lost",
DateTimeYear[Outlet Min_Week Ending] = 2020, "New",
DateTimeYear[Outlet Max_Week Ending] = 2018, "Other",
"Active"
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
90 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |