Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
New to Qlik Sense.
I have a pivot table that looks like the following with calculated columns:
Store ID | Last Month with Sales: MAX(Month) |
Reported in Previous Month? IF( (InMonth(Max(Month), TODAY(2), -1))=0,'NO','YES') |
Store Status IF( (InMonth(Max(Month), TODAY(2), -1))=0,'Closed','Open') |
Store_1 | 5/31/2024 | NO | Closed |
Store_2 | 11/30/2024 | YES | Open |
Store_3 | 11/30/2024 | YES | Open |
The above table is meant to show Stores, their most recent month with sales, whether or not a store made a sale in the last month, and based off of that, whether the store is closed or not. If a store made a sale in the past month they are considered "Open". If a store has not made a sale in previous month, they are considered "Closed".
I want to create two separate KPIs that simply counts the number of stores who are considered 'Closed' and 'Open'.
Please advise on how to create an expression to count 'Closed' and 'Open' stores in a KPI chart.
Thank you!
If you load from an SQL DB directly it should look something like this:
I don't think you need a LEFT or Floor() function as the set analysis looks at a range. I changed to timestamp and it still worked with the earlier formula.
Does it work with the following data for you?
mydata:
load * inline [
Store_ID,Month
Store_1,2024-05-31 00:00:00.000000
Store_1,2024-11-30 00:00:00.000000
Store_2,2024-11-30 00:00:00.000000
Store_3,2024-11-30 00:00:00.000000
Store_4,2024-05-31 00:00:00.000000
];
exit Script;