Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
deblina_rai
Contributor III
Contributor III

Latest month sales for a year or Quarter in Scripting

HI,

I need to create a master measure as latest month sales for selected quarters or Year  in such way so that this measure can be used a with any no of dimensions.

 

Q2 19 – should give us the asset from Jun 19

Q1 19 – should give us the asset from Mar 19

Q4 18 – should give us the asset from Dec 18 and so on

Labels (2)
2 Replies
Vegar
MVP
MVP

Assuming you have a YearMonth field in your calendar (It could be created by using MonthName(Datefield) as YearMonth in your script.

Then you could use this expression, hence the last month in a selected quarter will also be the last month in your selection.

=sum(
{<
YearMonth = {'$(=MaxString(YearMonth))'}
>}
Assets)

 

deblina_rai
Contributor III
Contributor III
Author

Hi,

This is working for latest month sales of selected year. But If I select  2 Quarter it  is giving last quarter only. I need lasts month for both the selected quarter. And I cant add quarter or month in aggr level as we are not sure how many dimension user will  use in real time.

We need to provide master measure for Quarter and Year scenario. Using maxstring year is working  fine. But For quarter its giving for last quarter only whereas I have selected two Quarter  .