Forum Discussion

Masoud_'s avatar
Masoud_
Frequent Visitor
4 years ago
Solved

How to write my excel formula in DAX

Hi every one,   I have a formula in Excel and I am trying to write it in DAX but I am new and I don't know how to do that. The code is not complicated, but I am struggelling a few days to solve it...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Masoud_ ,

    You can create a calculated column as below to get it, please find the details in the attachment.

    Column = 
    VAR _cur = 'Table'[Celsius]
    VAR _cur1 =
        CALCULATE (
            MAX ( 'Table'[Celsius] ),
            FILTER ( 'Table', 'Table'[Temp#55] = EARLIER ( 'Table'[Temp#55] ) + 1 )
        )
    VAR _cur2 =
        CALCULATE (
            MAX ( 'Table'[Celsius] ),
            FILTER ( 'Table', 'Table'[Temp#55] = EARLIER ( 'Table'[Temp#55] ) + 2 )
        )
    VAR _cur3 =
        CALCULATE (
            MAX ( 'Table'[Celsius] ),
            FILTER ( 'Table', 'Table'[Temp#55] = EARLIER ( 'Table'[Temp#55] ) + 3 )
        )
    VAR _cur4 =
        CALCULATE (
            MAX ( 'Table'[Celsius] ),
            FILTER ( 'Table', 'Table'[Temp#55] = EARLIER ( 'Table'[Temp#55] ) + 4 )
        )
    RETURN
        IF (
            _cur4 - _cur3 > 0
                || _cur3 - _cur2 > 0,
            1,
            IF ( _cur2 - _cur1 > 0 && _cur3 - _cur4 > -0.05, 1, 0 )
        )

    If the above one can't help you get the desired result, please provide some sample data in the table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

    How to upload PBI in Community

    Best Regards