Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dgmokati
Contributor II
Contributor II

Use Where clause in LET

Hi All,

I want to use where clause in Let,

My requirement is to calculate count of distinct weeks for the latest quarter using global variable(LET).

Let vMaxWeek =count (distinct (quarter) where week =max('Week')

Please help me achieve this scenario .

Below is my sample data

YearQuarterWeek
201320131W1
201320131W2
201320131W3
201320131W4
201320131W1
201320131W2
201320131W3
201320131W4
201320131W1
201320131W2
201320131W3
201320131W4
201320131W5
201320132W1
201320132W2
201320132W3
201320132W4
201320132W1
201320132W2
201320132W3
201320132W4
201320132W5
201320132W1
201320132W2
201320132W3
201320132W4

 

Kindly Help.

 

Thanks in Advance.

Labels (4)
2 Replies
Channa
Specialist III
Specialist III

try to have IF (week =max(week), count())

Channa
dwforest
Specialist II
Specialist II

Have your logic backwards as it would count quarters and sadly there is no where in an aggregrate.

During load, if you used an if, it would process row by row, meaning the Max would always be as of the last record loaded.

As a variable, post load, you could use something like:

Count({<Quarter={"=max(TOTAL Quarter)"}> Distinct Week)