Forum Discussion

trying's avatar
trying
Frequent Visitor
4 years ago
Solved

Max Value of Measure

Hi all,

 

i am struggeling to get the max value of the measure i have written here:

 

Total Complaints | Last 12 Months =
var maxDate = LASTDATE('Calendar'[Date])
var minDate = FIRSTDATE('Calendar'[Date])
Return
CALCULATE([cpm (complaints per millions)],
Filter('Calendar_helper','Calendar_helper'[Date]<=maxDate &&
'Calendar_helper'[Date]>=DATEADD(minDate,-12,MONTH)),
ALL('Calendar')
)
 
Can anyone help?
 
Thanks in advance and KR,
Daniel
  • Measure = 
    
    Var T1 =
    
    	Summarize(
    		calendar, YearMonth, "_Value", [cpm (complaints per millions)]
    	) // This should return a table with months and the corresponding cpm.
    	  // you'll have to limit the data to the last 12 months
    	  // Maybe with a FILTER on the calender in the first argument in summarize or on T1
    
    Var _Max = 
    maxx(
    	T1, _value)


    To be more specific i'd need a .pbix for testing

3 Replies

    • trying's avatar
      trying
      Frequent Visitor

      thanks for the reply! I try to get the max value for the measure up above. Meaning which is the max value within those 12 months i have in the measure.

       

       

      • NickolajJessen's avatar
        NickolajJessen
        Icon for Solution Sage rankSolution Sage
        Measure = 
        
        Var T1 =
        
        	Summarize(
        		calendar, YearMonth, "_Value", [cpm (complaints per millions)]
        	) // This should return a table with months and the corresponding cpm.
        	  // you'll have to limit the data to the last 12 months
        	  // Maybe with a FILTER on the calender in the first argument in summarize or on T1
        
        Var _Max = 
        maxx(
        	T1, _value)


        To be more specific i'd need a .pbix for testing