Forum Discussion

ManchevB's avatar
ManchevB
Icon for Helper II rankHelper II
2 years ago

Converting a QlikSense expression into a Power BI measure

5 Replies

  • Here is a link to a sample report where the data sits: Sample Report  , for the outcome, I can only share a snapshot of the percents I am looking to get: 

     

    the example I am using is Engineer badge id: 50000660

     

     

    and on Onsite Month: 

     

     

    Unfortunatelly I am not able to send extract of the data from QlikSense, I only have the expression that calculates the utilization: Sum({<WO_Type_Name={'Repair', 'Installation', 'Proactive', 'Onsite T&E case', 'Genesis'}, IsPI_WO={1}, [WO Total Time In Hours]={"<=14"}>} [WO Total Time In Hours])/
    Sum(Aggr(Count({<WO_Type_Name={'Repair', 'Installation', 'Proactive', 'Onsite T&E case', 'Genesis'}, IsPI_WO={1}, [WO Total Time In Hours]={"<=14"} >} DISTINCT Onsite_Date_WO), Onsite_Month_WO, [Engineer Badge Id]))/
    Avg(Aggr({<WO_Type_Name={'Repair', 'Installation', 'Proactive', 'Onsite T&E case', 'Genesis'}, IsPI_WO={1}, [WO Total Time In Hours]={"<=14"} >} SUM(STD), Onsite_Month_WO, [Engineer Badge Id]))

     

     this is the one I need to convert to a Power BI DAX formula. 

     

    I remain available if more clarification is needed. 

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ManchevB ,

     

    I don't know much about QlikSense, I hope the following expression will help you:

    VAR TotalTimeInHours = 
    CALCULATE(
        SUM('Table'[WO Total Time In Hours]),
        'Table'[WO_Type_Name] IN {"Repair", "Installation", "Proactive", "Onsite T&E case", "Genesis"},
        'Table'[IsPI_WO] = 1,
        'Table'[WO Total Time In Hours] <= 14
    )
    
    VAR CountDistinctDates = 
    CALCULATE(
        DISTINCTCOUNT('Table'[Onsite_Date_WO]),
        'Table'[WO_Type_Name] IN {"Repair", "Installation", "Proactive", "Onsite T&E case", "Genesis"},
        'Table'[IsPI_WO] = 1,
        'Table'[WO Total Time In Hours] <= 14,
        ALLEXCEPT('Table', 'Table'[Onsite_Month_WO], 'Table'[Engineer Badge Id])
    )
    
    VAR AverageSTD = 
    CALCULATE(
        AVERAGE('Table'[STD]),
        'Table'[WO_Type_Name] IN {"Repair", "Installation", "Proactive", "Onsite T&E case", "Genesis"},
        'Table'[IsPI_WO] = 1,
        'Table'[WO Total Time In Hours] <= 14,
        ALLEXCEPT('Table', 'Table'[Onsite_Month_WO], 'Table'[Engineer Badge Id])
    )
    
    RETURN
    DIVIDE(
        TotalTimeInHours,
        CountDistinctDates,
        BLANK()
    ) 
    

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

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

     

    • ManchevB's avatar
      ManchevB
      Icon for Helper II rankHelper II

      Hey, thank you for this effort!

       

      I tried using chat GPT to convert the QlikSense formula to DAX in numerous ways, but still the result is not what I have in QlikSense: I am trying to replicate the utilization and get the exact same numbers.. .

  • Sorry, somehow missclicked and accepted this as solution but the case still remains unsolved*