Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
trishita
Creator III
Creator III

Error in set analysis syntax

Can any one tell me what could be the error in using set analysis with multiple ifs..whenever i am using a set analysis statement individually, it is not showing any problem but whenever i AM TRYING TO USE IT FOR SEPARATE CASES its throwing error:

Garbage after expression ','

if (Match([Actual_Fuel_Type],'HSFO'), sum( total  {$<Actual_Fuel_Type={'HSFO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000)),

if (Match([Actual_Fuel_Type],'LSDO'), sum( total  {$<Actual_Fuel_Type={'LSDO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000)),

if (Match([Actual_Fuel_Type],'HSDO'), sum( total  {$<Actual_Fuel_Type={'HSDO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000)),

if (Match([Actual_Fuel_Type],'ULSFO'),sum( total  {$<Actual_Fuel_Type={'ULSFO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000)),'Unknown'))))

Note: Individual statements are working fine:

if (Match([Actual_Fuel_Type],'HSFO'), sum( total  {$<Actual_Fuel_Type={'HSFO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000))

This is still working but its not working whenever I am using multiple case statements

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

I think you are closing all the if statement before the next one begins... try this

If(Match([Actual_Fuel_Type], 'HSFO'), Sum(TOTAL {$<Actual_Fuel_Type = {'HSFO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

If(Match([Actual_Fuel_Type], 'LSDO'), Sum(TOTAL {$<Actual_Fuel_Type = {'LSDO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

If(Match([Actual_Fuel_Type], 'HSDO'), Sum(TOTAL {$<Actual_Fuel_Type = {'HSDO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

If(Match([Actual_Fuel_Type], 'ULSFO'), Sum(TOTAL {$<Actual_Fuel_Type = {'ULSFO'}>} FUEL_MASS_BEFORE_SOUNDING/1000), 'Unknown'))))

View solution in original post

6 Replies
sunny_talwar
MVP
MVP

I think you are closing all the if statement before the next one begins... try this

If(Match([Actual_Fuel_Type], 'HSFO'), Sum(TOTAL {$<Actual_Fuel_Type = {'HSFO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

If(Match([Actual_Fuel_Type], 'LSDO'), Sum(TOTAL {$<Actual_Fuel_Type = {'LSDO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

If(Match([Actual_Fuel_Type], 'HSDO'), Sum(TOTAL {$<Actual_Fuel_Type = {'HSDO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

If(Match([Actual_Fuel_Type], 'ULSFO'), Sum(TOTAL {$<Actual_Fuel_Type = {'ULSFO'}>} FUEL_MASS_BEFORE_SOUNDING/1000), 'Unknown'))))

sunny_talwar
MVP
MVP

Or try this

Pick(Match([Actual_Fuel_Type], 'HSFO', 'LSDO', 'HSDO', 'ULSFO') + 1,

'Unknown',

Sum(TOTAL {$<Actual_Fuel_Type = {'HSFO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

Sum(TOTAL {$<Actual_Fuel_Type = {'LSDO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

Sum(TOTAL {$<Actual_Fuel_Type = {'HSDO'}>} FUEL_MASS_BEFORE_SOUNDING/1000),

Sum(TOTAL {$<Actual_Fuel_Type = {'ULSFO'}>} FUEL_MASS_BEFORE_SOUNDING/1000))

trishita
Creator III
Creator III
Author

Currently I used the following fixed code:

if (Match([Actual_Fuel_Type],'HSFO'), sum( total  {$<Actual_Fuel_Type={'HSFO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000),

if (Match([Actual_Fuel_Type],'LSDO'), sum( total  {$<Actual_Fuel_Type={'LSDO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000),

if (Match([Actual_Fuel_Type],'HSDO'), sum( total  {$<Actual_Fuel_Type={'HSDO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000),

if (Match([Actual_Fuel_Type],'ULSFO'),sum( total  {$<Actual_Fuel_Type={'ULSFO'}>}FUEL_MASS_BEFORE_SOUNDING/ 1000),'Unknown'

))))

But now I am having the following error:The records are duplicated

sunny_talwar
MVP
MVP

Do you have hidden dimensions in your chart?

trishita
Creator III
Creator III
Author

Yah I created something fresh..Its working now...

sunny_talwar
MVP
MVP

Awesome, please close the thread by marking correct and helpful responses.

Best,

Sunny