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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
staceyzhang
Contributor II
Contributor II

2 filters for different dimensions in expression (Inventory ending balance in each quarter)

Hello,

I am trying to draw a line chart which could show inventory ending balance for each quarter. 

My data table like this: monthly trial balance for each account (Inventory is the account code starts with "1-14*"). 

staceyzhang_1-1657056848789.png

I want to set expression to detect the last month of each quarter and also sum of all related inventory account as ending balance. Ex. it will show Q1 as Mar. inventory ending balance to represent.

However, my expression could not go though:

sum({$<AccountCode={"1-14*"}> + QuarterEnd([Year-Quarter])}[TB.EndingBalance])

Please suggest!

Thank you so much!

Stacey

 

Labels (3)
1 Solution

Accepted Solutions
staceyzhang
Contributor II
Contributor II
Author

I tried another way and it had been fixed ^^.

In script, I created a new column to get TB.Month. In Chart expression, I put "Sum(if((left(AccountCode,4)= '1-14') and ([TB.Month]= month(QuarterEnd([DA.ReportDate-TB.ReportDate]))),[TB.EndingBalance]))".

Thank you for your help!

View solution in original post

4 Replies
sidhiq91
Specialist II
Specialist II

@staceyzhang  Please see the below explanation. 

Quarterend() function gives the result in the form of 03/31/2022. 

You need to modify your set expression a little bit:

Sum({<AccountCode={"1-14*"},[TB.ReportDate]={"=$(=Quarterend(Today()))"}>}[TB.EndingBalance])

If this resolves your issue, please like and accept it as your solution.

staceyzhang
Contributor II
Contributor II
Author

Thank you for your response.

I tried this on, but it still shows sum of 3 months balance (Jan-Mar) together as Q1. I am not quite sure, but I want to get each quarter could detect and show the last month's balance. 

Q1: showing March ending balance (sum of  AccountCode={"1-14*"} from [TB.EndingBalance]

Q2: showing June ending balance 

Q3: showing Sept ending balance

Q4: showing Dec ending balance

Thank you .

sidhiq91
Specialist II
Specialist II

@staceyzhang with the expression that I have provided should give only Quarter end results.  Since the issue still continues could you please provide your expression and sample data?

staceyzhang
Contributor II
Contributor II
Author

I tried another way and it had been fixed ^^.

In script, I created a new column to get TB.Month. In Chart expression, I put "Sum(if((left(AccountCode,4)= '1-14') and ([TB.Month]= month(QuarterEnd([DA.ReportDate-TB.ReportDate]))),[TB.EndingBalance]))".

Thank you for your help!