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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cash collected in the current month.

Hello All,

Current month calc.PNG

The above table shows a sales ledger extract.


I'm trying to calculate, by "cust ref", the current month "total value" where "doc type" is equal to "SLCSH". This should give me the total amount of cash collected in the current month.


The output should look something like this.


Current month calc output.PNG

Many thanks in advance.


Paul.

4 Replies
Anil_Babu_Samineni

Try like this in Straight Table

Dimension is -- Cust ref

Expression is

FirstSortedValue([Total value], Cust ref)

OR

FirstSortedValue([Total value], -Cust ref)

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
Not applicable
Author

Hi!

Try with this in your table:

1. select Cust ref as dimension

2. Expression: sum({$<[Doc type]={'SLCSH'}>} [Total value])

You just filtered by period


Regards!

Not applicable
Author

Hi,

This works but i really need it to only ever show the current month.

Kind regards,

Paul.

Not applicable
Author

In Script I have declared vCurrMonth variable

Let vCurrMonth = Month(today());

To include current month in expression (other wise use @hugo morales expression above)

  =Sum(if(Month([Invoice date])= '$( vCurrMonth)' and [Doc Type]='SLCSH', [Total Value]))

]))

Set analysis expression worked with current month after I have loaded month column from csv file.

=Sum({<[Doc number]={'BACS'}, [Invoice Month] = {'$( vCurrMonth)'} >}[Total Value])

Load script

Sales:
LOAD [Cust ref],
     
date([Invoice date]) as [Invoice date],
     
month(date([Invoice date])) as [Invoice Month],//added extra month column
     
[Doc number],
     
[Doc Type],
     
[Total Value]
FROM

(
ooxml, embedded labels, table is Sheet1);



Note: Unless you have November month (current month) data, using current month in expression will result zero values.