I have some monthly sales data since 2010 and wanted to create a dashboard where a user can compare 2 separate YearMonth sales by using the same dropdowns/filters. These 2 months can be anything eg Jan-2013 vs March-2019 etc. After selecting two months in the filter, a user should see a text box with the difference of the values in those two months' sales.
I know how to do it with two separate filters for each month using Alternate State but users want only one filter where they can select two random months and see the sales difference.
@qlikwiz123 You can use set like below to get difference. You can update the difference calculation according to your logic. I have used latest month(using max) - last month. Make sure that your YearMonth field is formatted using date function so that you can apply max or min function over it.
=sum({<YearMonth={"$(=date(max(YearMonth),'MMM-YYYY'))"}>}Sales)-sum({<YearMonth={"$(=date(min(YearMonth),'MMM-YYYY'))"}>}Sales)