Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Roveqz
Contributor
Contributor

sum of of data for a specific months with current data only

Hi,

 I have the following data below

DATE                      BUDGET        ACTUAL

1/25/2021             192.65           110.86

2/25/2021              192.65           177.27

3/25/2021              71.88             113.78

4/25/2021               79.58             127.44

5/25/2021               77.01             127.36

6/25/2021              77.57

Now i would like to get the percentage of  Actual data vs Budget Data for 1 to 5 only. which is 107%

My current formula is (SUM({<[MONTH <= MONTH(DATE)>} ACTUAL)/SUM({<[MONTH <= MONTH(DATE)]>} BUDGET)

but my result seems is not equal to 107%..

 

Appreciate your help.

 

 

1 Solution

Accepted Solutions
Digvijay_Singh

Your set expression format is wrong, if you want to check if your month in the date is less than Month of today's date you should try something like this, but not sure if you got month field in your data or not.

(SUM({<[MONTH] = {"<$(=MONTH(Today()))"}>} ACTUAL)/SUM({<[MONTH] = {"<$(=MONTH(Today()))"}>}BUDGET)

Or if I just use your sample data, this could also work - 

Sum({<ACTUAL = {"=Len(ACTUAL)>0"}>}ACTUAL)/Sum({<ACTUAL = {"=Len(ACTUAL)>0"}>}BUDGET)

View solution in original post

2 Replies
Digvijay_Singh

Your set expression format is wrong, if you want to check if your month in the date is less than Month of today's date you should try something like this, but not sure if you got month field in your data or not.

(SUM({<[MONTH] = {"<$(=MONTH(Today()))"}>} ACTUAL)/SUM({<[MONTH] = {"<$(=MONTH(Today()))"}>}BUDGET)

Or if I just use your sample data, this could also work - 

Sum({<ACTUAL = {"=Len(ACTUAL)>0"}>}ACTUAL)/Sum({<ACTUAL = {"=Len(ACTUAL)>0"}>}BUDGET)

Roveqz
Contributor
Contributor
Author

Thanks... It works perfectly!