Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

Help in expression

Hello got the following pivot table:

INVENTORY.png

when the pivot table is expanded the results are correct; now if the user collapses the Month column then the opening balance will be 1053, and balance qty will be 387 for the first product, 1156 and 890 for the second item and 527 and 313 for the third

check the expressions in the attached QVW and please advise

I can walk on water when it freezes
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Opening Balance Expression

if( dimensionality() = 4 , sum({<TrxType={'in','out'}>} Opening_Balance_Unit) ,

      sum({<TrxType={'in','out'} , MONTH_NUM = {$(=MIN(MONTH_NUM))}>} Opening_Balance_Unit)

)

Balance QTY Expression

if( dimensionality() = 4 , sum({<TrxType={'in','out'}>} Balance_Quantity_Unit) ,

      sum({<TrxType={'in','out'} , MONTH_NUM = {$(=MAX(MONTH_NUM))}>} Balance_Quantity_Unit)

)

help_in_Expression.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

5 Replies
vinieme12
Champion III
Champion III

Opening Balance Expression

if( dimensionality() = 4 , sum({<TrxType={'in','out'}>} Opening_Balance_Unit) ,

      sum({<TrxType={'in','out'} , MONTH_NUM = {$(=MIN(MONTH_NUM))}>} Opening_Balance_Unit)

)

Balance QTY Expression

if( dimensionality() = 4 , sum({<TrxType={'in','out'}>} Balance_Quantity_Unit) ,

      sum({<TrxType={'in','out'} , MONTH_NUM = {$(=MAX(MONTH_NUM))}>} Balance_Quantity_Unit)

)

help_in_Expression.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ali_hijazi
Partner - Master II
Partner - Master II
Author

I did the same but on the field Month_YEAR but it didn't work

so it works on MONTH_NUM instead

what if the user collapsed all columns and wants to see by brand then the opening balance will be the sum of opening balance of all items on the min date; SO I DO AGGREGATION?

I can walk on water when it freezes
sunny_talwar

It's seems to me that vinieme12‌'s response is already doing that? Isn't it?

Capture.PNG

vinieme12
Champion III
Champion III

No , work with the Dimensionality() value

For example

if( dimensionality() = 3 ,  // << if MonthNum collapsed, then min by Month

      sum({<TrxType={'in','out'} , MONTH_NUM = {$(=MIN(MONTH_NUM))}>} Opening_Balance_Unit)

      ,   //Else Sum

       sum({<TrxType={'in','out'}>} Opening_Balance_Unit)

)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ali_hijazi
Partner - Master II
Partner - Master II
Author

ah yes

I can walk on water when it freezes