Forum Discussion
Anonymous
6 years agoNot applicable
var + return multiple
hello can someone help me please i'm woindering if it's possible to have in a return clause multiple lignes here is the code that i'm wrinting Colonne_tes = var __tisDate = 'DimDate'[...
- 6 years ago
Hi Anonymous
if are you looking to pass multiple logical tests, then you can use SWITCH
columns = SWITCH( TRUE(), 'Product'[Color] = "Red", 1, 'Product'[Color] = "Blue", 2, 'Product'[Color] = "Black", 4, 3 --else )btw, your question is DAX related did you wanted to recreate it in Power Query?
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Mariusz
6 years agoCommunity Champion
Hi Anonymous
if are you looking to pass multiple logical tests, then you can use SWITCH
columns =
SWITCH(
TRUE(),
'Product'[Color] = "Red", 1,
'Product'[Color] = "Blue", 2,
'Product'[Color] = "Black", 4,
3 --else
)
btw, your question is DAX related did you wanted to recreate it in Power Query?
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
- Anonymous6 years agoNot applicable
hello using Mariusz Answer here is the solution may be it will help somebody
Colonne_11 =var __tisDate = 'DimDate'[FullDateAlternateKey]var __lastDateinTable = MAX(DimDate[FullDateAlternateKey])var __DaybeforToday = __lastDateinTable - 1var __Daybeforyesterday = __DaybeforToday - 1returnSWITCH(TRUE(),__tisDate = __lastDateinTable, 1,__tisDate = __DaybeforToday,2,__tisDate = __Daybeforyesterday,3,4)this gives you
05/03/2020 1
04/03/2020 203/03/2020 3
02/03/2020 4
01/03/2020 4
thanks to Mariusz for the help 🙂