Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
OmarBenSalem

How to return today's quarter in set expression?

hi all ( stalwar1😞

how to return today's quarter?

I was thinking about sthing like this (The syntax is for sure wrong);

sum({<Quarter={"=max(Month)=Month(Today()) "}>} Measure)



Now the question is, is my logic correct ; if so please help me correct the syntax.

and is there another way, simpler than this?

Thanks !

6 Replies
sunny_talwar

Max(Month) will always be (most likely) end of the quarter.... for example, let's assume we were in November... Max(Month) = 12 and Month(Today()) = 11.... Not sure if this can happen, but if it does, then it might not work....

OmarBenSalem
Author

Do u have a proposition on how to do?

I mean sthing like ?

sum({<Quarter={"=(Month)=Month(Today()) "}>} Measure)


with the right syntax?

MK9885
Master II
Master II

I don't know if the Quarter Flag would work for you?

In script you can use

if(InQuarterToDate(YOURDATEFIELD, today(),0), 1, 0) as CurQtrFlag,

This will always give you current quarter

sunny_talwar

Not entirely sure why you are taking this route, but may be this

Sum({<Quarter = p({<Month = {"$(=Month(Today())"}>} Quarter)>} Measure)

OmarBenSalem
Author

Thanks ; I'm aware of such an alternative, but I was wondering if there is a possibility to do such a thing directly within the set expression

MK9885
Master II
Master II

Year(Today())&'Q'&ceil(Month(Today())/3)

Store above in Variable and use the variable in your Set if you hvae correct format for year and quarter