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: 
paulyeo11
Master
Master

How to make it can display +ve or -ve for net profit amount ?

Hi All

I have below expression work fine when i select Revenue and Exp :-

Money(
fabs(
Sum(Aggr(SUM({<year = {"$(=Max(year)-0)"},month={"<=$(=Max({<sales = {'*'}, year = {$(=Max(year))}>}month))"},$(ColumnDim901)={$(ColumnDim901)}>}Amount*1)/$(Columndim89)/1000, $(ColumnDim108)))
)
,
$(vMoneyFormatK))

When i am not select Revenue and Exp , it should display net profit amount. since the expression is with Fabs , it alway display positive which is wrong. Hope some one can advise me how to make it able to display +ve or -ve ?

Paul Yeo

 

1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

if(GetSelectedCount([Pls select 901st Dim])<1,
Money(

Sum(Aggr(SUM({<year = {"$(=Max(year)-0)"},month={"<=$(=Max({<sales = {'*'}, year = {$(=Max(year))}>}month))"},$(ColumnDim901)={$(ColumnDim901)}>}Amount*1)/$(Columndim89)/1000, $(ColumnDim108)))
,
$(vMoneyFormatK)),
Money(
fabs(
Sum(Aggr(SUM({<year = {"$(=Max(year)-0)"},month={"<=$(=Max({<sales = {'*'}, year = {$(=Max(year))}>}month))"},$(ColumnDim901)={$(ColumnDim901)}>}Amount*1)/$(Columndim89)/1000, $(ColumnDim108)))
)
,
$(vMoneyFormatK))
)

View solution in original post

3 Replies
paulyeo11
Master
Master
Author

Hi All

Enclosed my QVW file.

Paul Yeo

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

if(GetSelectedCount([Pls select 901st Dim])<1,
Money(

Sum(Aggr(SUM({<year = {"$(=Max(year)-0)"},month={"<=$(=Max({<sales = {'*'}, year = {$(=Max(year))}>}month))"},$(ColumnDim901)={$(ColumnDim901)}>}Amount*1)/$(Columndim89)/1000, $(ColumnDim108)))
,
$(vMoneyFormatK)),
Money(
fabs(
Sum(Aggr(SUM({<year = {"$(=Max(year)-0)"},month={"<=$(=Max({<sales = {'*'}, year = {$(=Max(year))}>}month))"},$(ColumnDim901)={$(ColumnDim901)}>}Amount*1)/$(Columndim89)/1000, $(ColumnDim108)))
)
,
$(vMoneyFormatK))
)

paulyeo11
Master
Master
Author

Hi Fong

Thank you very much for your help,

it work fine now.

Paul Yeo