Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
On my chart I want to compare previous and current periods data. Previous period measure is conditional one:
For example, if I select 'This week' on my filter, previous period measure is calculated for previous week. But If today is Wednesday, i don't see any Thu-Sun data for previous week. The same issue is with 'This month'. If I delete conditions and write explicitly in previous perid expression:
= sum({<Period, wcOrderCreated = {">=$(=num(weekstart(today(),-1)))<$(=num(weekstart(today())))"}>}wcOrderTotal),
the chart shows me what is expected.
Thanks for any clarifications or workarounds proposed.
Sorry, I checked the wrong object in your application.
I would go for a totally different solution that is way easier and faster than if statements.
Just create another field in your in Period table. Look at my example. You only need this calculation:
sum({$< Period = , PreviousPeriod = {'$(=MaxString(Period))'}>}wcOrderTotal)
You can change the MaxString to whatever fits our need, but you're off the horrible IF statement.
Jordy
Climber
Hi Andrei,
Can you share your QVF maybe with test data? It's probably the set analysis that is not working correctly. But without data, it's hard to test here.
Jordy
Climber
Thanks for the prompt reply! Here is my test app, please select 'This week' to compare.
If I do this manually I don't have any issue with the set analysis.
But you are using an IF that I don't see in my test app. So how is this working?
Jordy
Climber
Hi Jordy,
I think I haven't got your question, could you please specify?
Sorry, I checked the wrong object in your application.
I would go for a totally different solution that is way easier and faster than if statements.
Just create another field in your in Period table. Look at my example. You only need this calculation:
sum({$< Period = , PreviousPeriod = {'$(=MaxString(Period))'}>}wcOrderTotal)
You can change the MaxString to whatever fits our need, but you're off the horrible IF statement.
Jordy
Climber
Hi Jordy,
Thank you so much for the solution proposed!
I have created "Previous" field as you advised and it works exactly as I need.
What I learned from many cases for now that Qlik doesn't like if() statements in dimension/measure expressions