Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
akmalquamri
Contributor III
Contributor III

Want to see sub column under each year for current year value and previous year values by a dimension

I want to make a table representing values as below:

| Category |                    2021                |                     2022                       |                        2023                  |

|                     |   current  |  previous    |    current    |     Previous      |    current    |     Previous     |

|  a                 |             21 |                     0 |                  32 |                       21 |                 20 |                      32 |

| b                  |             74 |                     0 |                  45 |                       74 |                 82 |                      74 |

 

I tried using set analysis in pivot but it is not working for other year in year 2021 column and so on.

Labels (3)
1 Solution

Accepted Solutions
Javizh
Partner - Contributor III
Partner - Contributor III

Hello @akmalquamri 

I think the function you are looking for is before()

  • Previous = before( Current,1)

Being current the metric you used for the first column, or:

  • Previous = before( column(1),1)

Best regards.

 

View solution in original post

2 Replies
Javizh
Partner - Contributor III
Partner - Contributor III

Hello @akmalquamri 

I think the function you are looking for is before()

  • Previous = before( Current,1)

Being current the metric you used for the first column, or:

  • Previous = before( column(1),1)

Best regards.

 

akmalquamri
Contributor III
Contributor III
Author

Thanks, Javizh,

It 's working