Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel-PNW
Contributor III
Contributor III

Score difference measure between dates?

Hoping someone can offer some helpful advice.  I understand creating measures in Qlik Sense (like in many examples using Sales x Quantity etc), but this scenario is a tricky one for me.

Each row contains date, score, location etc. My end goal is to have the ability to use a up or down arrow to show change and that requires figuring out the delta between two scores but based on sequential months.  Here's a simple data example ...

LOCATION   | SCORE   | DATE

East                |  70           | 9/30/2019

East                |  65           | 8/31/2019

East                |  70           | 7/31/2019

East                |  75           | 6/30/2019

North             |  30           | 9/30/2019

North             |  65           | 8/31/2019

North             |  50           | 7/31/2019

North             |  75           | 6/30/2019

Hope this makes sense and someone can point me in the right directly. Cheers!

6 Replies
sunny_talwar

What would be the expected output based on the sample data provided?

Daniel-PNW
Contributor III
Contributor III
Author

Thanks for asking Sunny,

That's one of those puzzling pieces to this. So this is survey questions and their aggregates scores at various locations. The questions stay the same but scores change each month. The final Pivot table visualization, has a filter to select reporting month, then the pivot table is populated with questions and scores. That pivot table is where I am hoping to bring in the score delta from last month.  So forgetting the up down arrow for a moment. just reporting the delta would suffice.

End product simply...

QUESTION                                        SCORE               DELTA

How would you rate us?                70                        3

Were staff helpful                              80                      -5

 

 

 

 

sunny_talwar

Where did the question come in from? Is Question a replacement for LOCATION in the sample data or is it an additional field? Also, how did you come up with 70 and 80? Which month do these values belong to?

Daniel-PNW
Contributor III
Contributor III
Author

Trying to keep it bare bones for easy of explaining and solution. I appreciate you sticking with me on this. So let's make it easy by just saying it's the most current month. The pivot table basically repeats scores left to right with the locations as the main column dimension. So like this.  Delta again is the piece that's puzzling to me. I  know I can this figure out in  XLS first, but again, I'm wondering if  it's possible using a  Qlik custom measure.  (In summary, somehow it has to compare the active month score with the previous month score, calculate the difference and be available as a master measure to insert into the pivot table.)

                                                             |          Location 1                |            Location 2        |         Location 3             |

QUESTION                                      |    SCORE        DELTA           |   SCORE        DELTA    |   SCORE        DELTA    |

How would you rate us?           |        70                3                  |       50                -7          |        20             -5            |

Were staff helpful                        |         80              -5                 |        60                6            |        90              7            |

sunny_talwar

But what exactly is DELTA here? How are you calculating these numbers?

Daniel-PNW
Contributor III
Contributor III
Author

What I'm wondering about is how to calculate that delta somewhere after the source file is complete. I mean, I can calculate it in Excel prior to bringing into Qlik, but I'm interested in either calculating the delta upon load statement or perhaps at the table column expression,, or master item, or?  I just don't understand where would be best place to do this in Qlik.

The reality is, it's a single data table with all the same fields.

The difference in the data is a single date change monthly, and score change. 

I need a simple subtraction to get score differences between the months. Easy to think about, not so easy to understand how to do that in Qlik... (at least for me ).