Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
AshR
Contributor II
Contributor II

How to evaluate Measure at the row level

I'm trying to create a "late order value" metric that is forecasted over time, but I can't figure out the measure. 

There are 2 tables (Dates, Orders); they are not joined.

The visual is a bar-chart with the DateMonth on the X-Axis. The dates table is complete, so min(DateDay) and max(DateDay) would be 1/1/2020 and 1/31/2020, respectively for the X-Axis category that corresponds to January of this year.

The formula for "LateOrders" would be something like this:

sum(
        {$<OrderDueDate={"<$(=max(DateDay))"},OrderCommitDate={">$(=max(DateDay))"}>}
OrderValue)

 The problem is that this seems to evaluate at the chart level, not for each individual month. If I run this calculation, it shows the same data in each month, calculated based on the last value in the chart (in this case 12/31/2020). How do I rewrite this to calculate for each X-Axis Cateogry in the chart?

Any help would be greatly appreciated!

Thanks

Labels (5)
1 Solution

Accepted Solutions
AshR
Contributor II
Contributor II
Author

Thanks, I've got a 90% solution using what you proposed.  The only downside to this approach is that it will require a new measure if I want the X-Axis to be "Year", "Week", or "Day". I can live with it; at least I don't have to duplicate data.

 

sum({$<OrderValue={"=[OrderDueDate]<=[ShipDate]"}>} if(OrderDueDate<=DateMonthEnd and ShipDate>DateMonthEnd ,OrderValue))

 

 Thanks for the help.

Update July 1, 2020: you can use this method in conjunction with GetObjectDimension() to make one measure that works with multiple timescales. Note that GetObjectDimension will return the displayed dimension label, not necessarily the dimension name.

View solution in original post

4 Replies
Taoufiq_Zarra

if I understand correctly.

you can add flag in your data model, because :

Taoufiq_ZARRA_0-1591850666332.png

Set Analysis help

so it normal that it shows the same data in each month

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
AshR
Contributor II
Contributor II
Author

Well, that's disappointing. Thank you for the quick reply.
Any idea how to accomplish this with a different approach? I realize that I could change the data model to import the data and calculate the Lates in the dataset, but that's going to duplicate a lot of data and seems like an inelegant solution.
Thanks.
tresesco
MVP
MVP

You could use Sum(If(... instead, that should give you the expected output. If you need more specific help, try to share a sample app to work on.

AshR
Contributor II
Contributor II
Author

Thanks, I've got a 90% solution using what you proposed.  The only downside to this approach is that it will require a new measure if I want the X-Axis to be "Year", "Week", or "Day". I can live with it; at least I don't have to duplicate data.

 

sum({$<OrderValue={"=[OrderDueDate]<=[ShipDate]"}>} if(OrderDueDate<=DateMonthEnd and ShipDate>DateMonthEnd ,OrderValue))

 

 Thanks for the help.

Update July 1, 2020: you can use this method in conjunction with GetObjectDimension() to make one measure that works with multiple timescales. Note that GetObjectDimension will return the displayed dimension label, not necessarily the dimension name.