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 ,
No. As I said before, your expression contains duplicated dates. They can't show both the two text but only the one that appear first.
Best Regards,
Icey
Icey
6 years agoCommunity Support
Hi pbiforum123 ,
Maybe this? Or, you can just create another column of "TotalSales".
Date_Group =
SWITCH (
TRUE (),
Sales[Date] >= DATE ( 1900, 1, 1 )
&& Sales[Date] <= DATE ( 2019, 9, 30 ), "SalesOlderThanThisMonth; TotalSales",
Sales[Date] >= DATE ( 2019, 9, 30 )
&& Sales[Date] <= DATE ( 2019, 10, 31 ), "SalesThisMonth; TotalSales",
Sales[Date] >= DATE ( 2019, 10, 31 )
&& Sales[Date] <= DATE ( 2019, 11, 30 ), "SalesNextMonth; TotalSales",
Sales[Date] >= DATE ( 2019, 11, 30 )
&& Sales[Date] <= DATE ( 2900, 12, 31 ), "SalesFuture; TotalSales"
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- pbiforum1236 years agoPost Patron
Thanka for sharing this idea. Unfortunately I wont be Total Sales as seperate column, even if I do that I wont be able to sort it in the order I want.