Forum Discussion
Help required in Switch statement
Hi pbiforum123 ,
But it works on my side.🤔 Can you show me what you want with an example?
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Did you get Total Sales in the Date group? I don't see that in your screen shot! Sorry if I had missed anything.
- Icey6 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
- pbiforum1236 years agoPost Patron
I understood! But our requirement is to show all the groups even though it is duplicate. Please let me know if that can be achieved in some way. Thanks
- Icey6 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.