Forum Discussion

schoden's avatar
schoden
Post Partisan
5 years ago
Solved

Apply Certain Date Range using ISBLANK

Hi Community, 

 

I have a measure to calculate total sales:

 

 

 

M= SUM(Sales[sales])

 

 

 

Now  I have put Date Range to show next 6 Months including current Month Feb 2021.

 

 

N= CALCULATE(M, DATESINPERIOD( Date, NOW(), 6 , MONTH)))

 

 

 

This is result :

 

May and July is blank hence doesnt appear , to show them on the graph;

 

 

 

Y= IF(ISBLANK(N), 0 , N) 

 

 

This pulls up entire date data and shows zero for entire date where as I needed for next 6 months only.

 

 

 

  • schoden , Try like

     

    0 between range 
    Measure = var _1= CALCULATE(SUM(Sales[sales]), DATESINPERIOD( Date, NOW(), 6 , MONTH)) +0 
    var _min = calculate(minx('Calendar', 'Calendar'[Date]) ,DATESINPERIOD( 'Calendar'[, NOW(), 6 , MONTH))
    var _max = calculate(maxx('Calendar', 'Calendar'[Date]) ,DATESINPERIOD( 'Calendar'[, NOW(), 6 , MONTH))
    return
    CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

10 Replies