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...
Icey
6 years agoCommunity Support
Hi pbiforum123 ,
What about this:
Date_Group =
SWITCH (
TRUE (),
Sales[Date] >= DATE ( 1900, 1, 1 )
&& Sales[Date] <= DATE ( 2019, 9, 30 ), "SalesOlderThanThisMonth",
Sales[Date] >= DATE ( 2019, 9, 30 )
&& Sales[Date] <= DATE ( 2019, 10, 31 ), "SalesThisMonth",
Sales[Date] >= DATE ( 2019, 10, 31 )
&& Sales[Date] <= DATE ( 2019, 11, 30 ), "SalesNextMonth",
Sales[Date] >= DATE ( 2019, 11, 30 )
&& Sales[Date] <= DATE ( 2900, 12, 31 ), "SalesFuture",
Sales[Date] >= DATE ( 1900, 1, 1 )
&& Sales[Date] <= DATE ( 2900, 12, 31 ), "Total Sales"
)Just put the expression of "Total Sales" to the last.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
pbiforum123
6 years agoPost Patron
I have already tried that it is not working as well.