Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
alexpanjhc
Specialist
Specialist

Or in set analysis

Hi Experts

We load in data daily except weekend and holiday

I need to use  monthend date and last day of the file load to create a chart

so I will show Jan 31 and Feb 1 data (assume today is Feb 1st)

I used the following as dimension, it is not showing anything,  

monthname(aggr(only({$<Date={"$(=max(Date))"}+MonthEndFlag={'1'}>} Date) , Date ))

 

If I used

monthname(aggr(only({$<Date={"$(=max(Date))"} >} Date) , Date ))

it will show Feb 1 bar (assuming it is a bar chart) as dim.

 

If i used 

monthname(aggr(only({$< MonthEndFlag={'1'}>} Date) , Date ))

it will show Jan 31 data.

 

How can i show both?

 

thanks in advance!

Labels (2)
4 Replies
vinieme12
Champion III
Champion III

As below

Latest Date and Previous Date

monthname(aggr(only({$<Date={'$(=max(Date))','$(=max(Date)-1)'}>} Date) , Date ))

 

Latest Date and Previous MonthEndDate

monthname(aggr(only({$<Date={'$(=Date(max(Date)))','$(=AddMonths(max(Date),-1))'}>} Date) , Date ))

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

May be use something like this as your dim - 

If(Yourdatefield = Monthend( Yourdatefield,-1) OR  Yourdatefield = Max(Yourdatefield),Yourdatefield)

May be try surrounding above  by Aggr if it doesn't work.

MayilVahanan

Hi

If you want to display all MonthEnd values like 31st Jan, 28th Feb, 31st Mar, etc. then try like below

=monthname(aggr(only({$< MonthEndFlag={'1'}>+<[Date]={'$(=Date(Max([Date])))'}>} [Date]) , [Date] ))

Else, @vinieme12 solution works,

monthname(aggr(only({$<Date={'$(=Date(max(Date)))','$(=MonthEnd(max(Date),-1))'}>} Date) , Date ))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
alexpanjhc
Specialist
Specialist
Author

Thanks all for your reply.  Now, when I select different date, I'd think that the bar will show my selected date and month end dates but it only shows the max(date).

eg

now there are feb 2 and feb 1 data but i am only seeing feb 2 and Jan 31 data

but if i selected feb 1 i expected to see Jan 31 and feb 1 data but still showing feb 2 data.

why?