Forum Discussion

Jwheels11's avatar
Jwheels11
New Member
1 year ago

Convert Tableau LOD expression to PowerBI DAX

Hello all,

I'd like to know how to convert this Tableau LOD expression into Power BI DAX. Could anyone help me, please?

 

[Change Date] =
{ FIXED [Id] :
MAX(IF [Change Date] <=(DATETIME(TODAY()) - 0.00001)
THEN [ Change Date] END) }

 

Thanks in advance!

3 Replies

  • Jonvoge's avatar
    Jonvoge
    Most Valuable Professional

    Hi Jwheels11

     

    My Tableau is a little rusty, but FIXED is roughly translateable to the ALLEXCEPT() function in DAX.

    And in replacement of DATETIME(TODAY()) you could use NOW(). 

     

     

    You would likely need to built something like:

     

    M_ChangeDate=

    Calculate(MAX('Table'[Change Date]), ALLEXCEPT('Table', 'Table'[Id]))

     

    And to add the NOW() filter, perhaps something like:

    M_ChangeDate=

    Calculate(MAX('Table'[Change Date]), ALLEXCEPT('Table', 'Table'[Id]), 'Table'[Change Date] <= NOW())

    _____________________________________________________
    I hope my comment was helpful.
    If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
    Find me on LinkedIn, Sessionize, or my blog Downhill Data

     

     

  • I need it to be a T/F otherwise it can't be used as a filter correctly

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Jwheels11 

     

    Thank you very much Jonvoge for your prompt reply.

     

    Try this:

     

    ChangeDate = 
    VAR MaxChangeDate = 
        CALCULATE(
            MAX('YourTable'[Change Date]),
            FILTER(
                'YourTable',
                'YourTable'[Id] = EARLIER('YourTable'[Id]) &&
                'YourTable'[Change Date] <= (TODAY() - 0.00001)
            )
        )
    RETURN
        IF(NOT(ISBLANK(MaxChangeDate)), TRUE, FALSE)

     

    Regards,

    Nono Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.