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: 
kolov007
Contributor III
Contributor III

The calculated string in the dimension

Hello.

I have a table with metrics. I need to calculate value for the certain line (Percent of Profit) by certain formula, and for the all other values by another sum([Amount of USD]).

I have a formula:

if(Metrics = 'Percent of Profit', Sum ({<Metrics = {'Sales'}>}[Amount of USD])/Sum ({{<Metrics = {'Cost'}>}[Amount of USD])-1,

[Amount of USD]) but this formula is invalid.


Please help me with this task.

Screenshot_1.png

1 Solution

Accepted Solutions
sunny_talwar

Try this

if(Metrics = 'Percent of Profit', Num(Sum(TOTAL {<Metrics = {'Sales'}>}[Amount of USD])/Sum(TOTAL {<Metrics = {'Cost'}>}[Amount of USD])-1, '#,##%'), Num([Amount of USD], '#,00'))


Capture.PNG

View solution in original post

4 Replies
Anil_Babu_Samineni

I don't have access to check. But, My assumption is

Sum(Aggr(if(Metrics = 'Percent of Profit', Sum ({<Metrics = {'Sales'}>}[Amount of USD])/Sum ({{<Metrics = {'Cost'}>}[Amount of USD])-1, [Amount of USD]), Metrics))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

Like this?

Capture.JPG

kolov007
Contributor III
Contributor III
Author

It's not work

Screenshot_2.png

sunny_talwar

Try this

if(Metrics = 'Percent of Profit', Num(Sum(TOTAL {<Metrics = {'Sales'}>}[Amount of USD])/Sum(TOTAL {<Metrics = {'Cost'}>}[Amount of USD])-1, '#,##%'), Num([Amount of USD], '#,00'))


Capture.PNG