Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Tableau Fixed function to Power BI DaX

Hi,

 

Can anyone help me to convert from Tableau LOD to DAX .

 

{ FIXED [Employee Name],[Week Update] : SUM(
IF { FIXED :([time])}>36
THEN 1
ELSE 0
END
) }

 

 

Example data & Example result

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create calculated column.

    Sum1 =
    CALCULATE(SUM('Table'[The number of Hours(Overtime)]),FILTER(ALL('Table'),'Table'[Employee Name]=EARLIER('Table'[Employee Name])&&'Table'[Week]=EARLIER('Table'[Week])))
    OT over 36 hours per week =
    var _count=CALCULATE(DISTINCTCOUNT('Table'[Employee Name]),FILTER(ALL('Table'),'Table'[Week]=EARLIER('Table'[Week])&&'Table'[Sum1]>=36))
    return
    IF(
    _count=BLANK(),0,_count)

    2. Put into the matrix, and design [OT over 36 hours per week] as MIN

    3. Result:

    Please click here for the pbix file

     

    Best Regards,

    Liu Yang

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

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create calculated column.

    Sum1 =
    CALCULATE(SUM('Table'[The number of Hours(Overtime)]),FILTER(ALL('Table'),'Table'[Employee Name]=EARLIER('Table'[Employee Name])&&'Table'[Week]=EARLIER('Table'[Week])))
    OT over 36 hours per week =
    var _count=CALCULATE(DISTINCTCOUNT('Table'[Employee Name]),FILTER(ALL('Table'),'Table'[Week]=EARLIER('Table'[Week])&&'Table'[Sum1]>=36))
    return
    IF(
    _count=BLANK(),0,_count)

    2. Put into the matrix, and design [OT over 36 hours per week] as MIN

    3. Result:

    Please click here for the pbix file

     

    Best Regards,

    Liu Yang

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous ,

                 Thank you for advise, My results have been success. 

      Thank you very much.

  • mwegener's avatar
    mwegener
    Most Valuable Professional

    Hi Anonymous ,

     

    can you provide example data and an example result?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi , mwegener 

     

    This is  example data and an example result , Would you recommend something?

     

    Thank you.