Forum Discussion

ABC11's avatar
ABC11
Resolver I
4 years ago

Need help on DAX function with measure vs column

Hello,

Lastest_WorkDate = CALCULATE(MAX(LEM_FACTS[WORKDATE]))-this is measure column
NO_OF_DAYS_Running Behind = DATEDIFF(LEM_FACTS[Lastest_WorkDate],TODAY(),DAY)-this is measure column
Level_1 =Switch( true(),
LEM_FACTS[NO_OF_DAYS_Running Behind]4,"GOOD",
LEM_FACTS[NO_OF_DAYS_Running Behind]<7,"Email Vendor", LEM_FACTS[NO_OF_DAYS_Running Behind]<21,"Action Immediately", LEM_FACTS[NO_OF_DAYS_Running Behind]<61,"Check to see if it's on site","Off Site")

This is working perfectly fine as measure column but when I do as add column its not.

I need to do column because I need to do graph as well.

Any help would be appriciate.

Thanks,

 

14 Replies

  • Hi, ABC11 
    Could you please clarify more clearly why and what it's not working? I suppose I don't see the problem you're talking about.

    • ABC11's avatar
      ABC11
      Resolver I

      Thanks to Vojtechsima.

      Everthing is working in measaure column. I need to do these as add column becuase I need to draw graph(pie) and do the summary report as %. In order to do that I need this calculation as column (not measure) 

      Please, help me

  • SpartaBI's avatar
    SpartaBI
    Community Champion
    Hey ABC11 ,
    Just wrtie this funcion in a new column (I've put everyhing in one column):
    Level 1 = 
    VAR _Lastest_WorkDate =  LEM_FACTS[WORKDATE]
    VAR _Diff = DATEDIFF(Lastest_WorkDate,TODAY(),DAY)
    VAR _Result =
    switch(
     
    true(),

    _Diff < 4,"GOOD",
    _Diff<7,"Email Vendor",
    _Diff<21,"Action Immediately",
    _Diff<61,"Check to see if it's on site",
    "Off Site")
    RETURN
    _Result


    Hope this helps
    • ABC11's avatar
      ABC11
      Resolver I

      Hello,

      I am getting this error" Failed to resolve name 'LEM_FACTS'. It is not a valid table, variable, or function name." My table bname is this for sure

      Please

      Thanks for your time