Forum Discussion
pbiforum123
6 years agoPost Patron
Help required in Switch statement
Since the first statement for "Total Sales" consists of the dates rest of the statement is not executed. If I remove the first statement which is "Total Sales" rest of the statement is executed. Wha...
pbiforum123
6 years agoPost Patron
Since it has confidential data it cannot be shared. Sorry!
Anonymous
6 years agoNot applicable
Hi pbiforum123 ,
Yeah, I understood no problem.
I just gave some sample records and use the below dax for your request.
Date_Group =
SWITCH (
TRUE (),
Sample[Date] >= date(2019,9,1)
&& Sample[Date] <= date(2019,9,30), "SampleOlderThanThisMonth",
Sample[Date] >= date(2019,9,30)
&& Sample[Date] <= date(2019,10,31), "SampleThisMonth",
Sample[Date] >= date(2019,10,31)
&& Sample[Date] <= date(2019,11,30), "SampleNextMonth",
Sample[Date] >= date(2019,11,30)
&& Sample[Date] <= date(2900,12,31), "SampleFuture",
Sample[Date] >= date(1900,1,1)
&& Sample[Date] <= date(2900,12,31), "Total Sample"
)
Output:
Best Regards,
Mail2inba4
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Mail2inba4
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.