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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
suvechha_b
Creator III
Creator III

How to write the expression ?

I have declare the following :

MonthPeriod:

Load * inline [

     Fiscal Month,Period   

     Jul,1

     Aug,2

     Sep,3

     Oct,4

     Nov,5

     Dec,6

     Jan,7

     Feb,8

     Mar,9

     Apr,10

     May,11

     Jun,12   

     ];

one variable : vPrevious :Month(AddMonths(Date(Today()),-1)) which gets the value " feb "

I want to use the value 8 from the inline function MonthPeriod for the below expression :

sum({<[fis_period] = {8} >}[Stag Forecast Units])

as fis_period use 8 instead of feb .

But the above query is incorrect . Please help me to write the expression.

1 Solution

Accepted Solutions
PrashantSangle

Hi,

Go to vw_fact_dop_forecast_stagger table

rename fis_period field as Period

OR

fis_period field as [Fiscal Period]

So that You can create Link between vw_fact_dop_forecast_stagger and Your Inline Table

Then Use Your Expression,

It will work correctly,

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

13 Replies
MK_QSL
MVP
MVP

SUM({<[fis_period] = {'$(=NUM(Month(AddMonths(Today(),-1))))'}>}[Stag Forecast Units])

michael_maeuser
Partner Ambassador
Partner Ambassador

you need to add a group by --> all fields that are not part of an aggregation in this table, e.g.

load

DimA,

DimB

sum({<[fis_period] = {8} >}[Stag Forecast Units]) as fis_period use 8 instead of feb

group by DimA, DimB

sql selectz...;

sushil353
Master II
Master II

are you getting any error.

Expression above seems correct.. please explain what issue you are getting.

suvechha_b
Creator III
Creator III
Author

But this expression is giving value 2 . I dont want that ....

I want   Feb,8 thats why I wrote the Inline function.

How to get feb = 8 in the above expression.

jsingh71
Partner - Specialist
Partner - Specialist


Find Attachment.

In expression change your dimension name.

Instead of fis_period use Period.

--Jai

PrashantSangle

Hi,

You can do this in script level .

Instead of Creating Inline table your script you can do this way

if(num(month(CalenderDate)) >6,num(month(CalenderDate))-6,num(month(CalenderDate))+6) as FiscalMonth

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
suvechha_b
Creator III
Creator III
Author

I am using this expression :

SUM({<[fis_period] = {'$(=NUM(Month(AddMonths(Today(),-1))))'}>}[Stag Forecast Units])


the following exp :'$(=NUM(Month(AddMonths(Today(),-1))))' is giving value 2


but Instead of 2 I want 8 .


Thus, I have declare :


MonthPeriod:

Load * inline [

     Fiscal Month,Period  

     Jul,1

     Aug,2

     Sep,3

     Oct,4

     Nov,5

     Dec,6

     Jan,7

     Feb,8

     Mar,9

     Apr,10

     May,11

     Jun,12  

     ];

But how to write the expression to get the value of :'$(=NUM(Month(AddMonths(Today(),-1))))' as 8 insteat of 2.

MK_QSL
MVP
MVP

Or try this.. this should work..

=SUM({<[fis_period] = {"$(=Month(AddMonths(Today(),-1)))"}>}[Stag Forecast Units])

suvechha_b
Creator III
Creator III
Author

=SUM({<[Fiscal Month] = {"$(=Month(AddMonths(Today(),-1)))"}>}[Stag Forecast Units])

How I can use the following expression instead of above :

=SUM({<[Period] = {8}>}[Stag Forecast Units])

as [Stag Forecast Units] field doesnot depend on [Fiscal Month] but depends on [Period] i.e ex , 8 for month feb