Forum Discussion

rakary_10's avatar
rakary_10
Regular Visitor
3 years ago
Solved

Dax date before today

Hi could you please help me?

Availability = IF ('Supply T&O dec 8th'[FAD] .[Date] <= TODAY(),"Now Available",IF('Supply T&O dec 8th'[FAD] .[Date] >= TODAY() + 30, "Coming Available", "Not available"))

I'd like to get the following:
IF FAD is equals to or less than today, now available, if FAD is equals to in coming 15 days, coming available and otherwise not available.

I've created a column and trying to use this dax

Thanks for your help

 

  • Hi,

    Try this calculated column formula

    Availability = IF('Supply T&O dec 8th'[FAD]<= TODAY(),"Now Available",IF('Supply T&O dec 8th'[FAD]>=TODAY()+30,"Coming Available","Not available"))

4 Replies

  •  

    Availabitity =
    VAR __count1 = COUNTROWS(FILTER('Supply T&O dec 8th', 'Supply T&O dec 8th'[FAD] <= TODAY))
    VAR __count2 = COUNTROWS(FILTER('Supply T&O dec 8th', 'Supply T&O dec 8th'[FAD] <= (TODAY + 15)))
    VAR __result = IF (__count1 >=1,
    				"Available",
    				IF (__count2 >= 1, 
    					"Coming available",
    					"Not available"
    					)
    			)
    RETURN
    __result

     

    • rakary_10's avatar
      rakary_10
      Regular Visitor

      It doesn't work when I create a column

       

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Try:

    Availability = 
    VAR _Date = DATE(YEAR('Supply T&O dec 8th'[FAD]), MONTH('Supply T&O dec 8th'[FAD]), DAY('Supply T&O dec 8th'[FAD]))
    RETURN
    SWITCH(TRUE(),
    _Date <= TODAY(),"Now Available",
    _Date >= TODAY() +30,"Coming Available", 
    "Not available"))
  • Hi,

    Try this calculated column formula

    Availability = IF('Supply T&O dec 8th'[FAD]<= TODAY(),"Now Available",IF('Supply T&O dec 8th'[FAD]>=TODAY()+30,"Coming Available","Not available"))