Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
AsifRahman
Contributor
Contributor

Create a Pie Chart using measures in different columns

I have a table like this:

Month Cat1 Cat2 Cat3
Jan 10 20 15
Feb 20 25 20
Mar 15 30 20
Apr 25 10 30
May 40 25 35

 

Would like to create a pie chart usig row Month of May, like this:

AsifRahman_0-1725180326110.png

Is it possible to do dynamically? Since my data model is already complex, cant pivot the data while loading.

Labels (1)
1 Solution

Accepted Solutions
MatheusC
Specialist
Specialist

 

Check out the valuelist function, create a list of synthetic values for your dimension, and from them return your measure values.

My example according to your data looks like this:

https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SyntheticD...

=ValueList('CAT1','CAT2','CAT3')

As a preference, using the pick function with match, I return the measure according to the sequence of listed values. Note that you can also achieve the same result using the if function:

pick(match(ValueList('CAT1','CAT2','CAT3'),'CAT1','CAT2','CAT3'), sum({<Month={'May'}>}Cat1), sum({<Month={'May'}>}Cat2), sum({<Month={'May'}>}Cat3))

See that I did it according to your data, so the value for May is fixed. I hope this helps you achieve your result.

MatheusC_0-1725288441683.png

 



- Regards Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

3 Replies
MatheusC
Specialist
Specialist

 

Check out the valuelist function, create a list of synthetic values for your dimension, and from them return your measure values.

My example according to your data looks like this:

https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SyntheticD...

=ValueList('CAT1','CAT2','CAT3')

As a preference, using the pick function with match, I return the measure according to the sequence of listed values. Note that you can also achieve the same result using the if function:

pick(match(ValueList('CAT1','CAT2','CAT3'),'CAT1','CAT2','CAT3'), sum({<Month={'May'}>}Cat1), sum({<Month={'May'}>}Cat2), sum({<Month={'May'}>}Cat3))

See that I did it according to your data, so the value for May is fixed. I hope this helps you achieve your result.

MatheusC_0-1725288441683.png

 



- Regards Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Kushal_Chawda

@AsifRahman  If you want to do it dynamically, it is better to convert your data into properly structured data using crosstable approach

https://help.qlik.com/en-US/qlikview/May2024/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptP...

 

AsifRahman
Contributor
Contributor
Author

Thanks man. Worked like a charm!