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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
anuhegde
Contributor III
Contributor III

Dynamic Periods in Dimension in a bar graph

Hi all,

I want a graph like below where the preiod should show FY2021 (if  last year is completed) , Q1,Q2,Q3( if the quarters in the current years are completed) and months (Oct, Nov) if the current quarter is not completed.

How can I do this in Qlik Sense?

anuhegde_1-1671199653691.png

 

Labels (7)
1 Reply
ogster1974
Partner - Master II
Partner - Master II

You're looking at creating a date bucket in your back end script.  Assuming you have a Date field add this top your calendar...

Load *,

If(Year(Date) <Year(Today()), Dual('FY' & Year(Date),Year(Date)),  

If(Year(Date) =Year(Today()) and Month(Date) <> Month(Today()), Dual('Q' & Quarter(Date) & ''' &  Year(Date),Year(Date)+(0.1*Quarter(Date))),  

If(Year(Date) =Year(Today()) and Month(Date) = Month(Today()), Dual(Monthname(Date),Year(Date)+(0.1*Quarter(Date))+(0.01*Quarter(Date))),

Dual(Null(),4000)))) as DateBucket;

The dual part will allow you to sort your bucket numerically.