Forum Discussion

pani_victoria's avatar
pani_victoria
Helper III
2 years ago

subtotal by lastdate

Hello!

Colleagues, I need help!

My data looks like this

 

 

 

 

 

 

 

 

 

 

 

 

 

 

There is a profitability plan for each territory.

 

In the matrix, I want to get a profitability plan by territory and period.

In one case, when I calculate the plan based on the minimum value, I have the result in the subtotals.

Measure 1 = minx('data', 'data'[profitability plan])
Measure 2 = SUMX ( VALUES ('data'[Territory]) , Measure 1)
 

In the second case, I want to calculate the result based on the maximum date, but I can’t do it. Where is the mistake?

Measure 3 =
VAR max_date = max('Date'[Date])
VAR result = CALCULATE(max('data'[profitability plan]), 'Date'[Date] = max_date)
return result
Measure 4 = SUMX ( VALUES ('data'[Territory]) , Measure 3) - ???




2 Replies