Forum Discussion

Bubufun's avatar
Bubufun
Frequent Visitor
2 years ago
Solved

Determining Actual Machine Operation Time by Filtering Out Test Period in Power BI

  Apologies for not expressing myself clearly. Some parts were not precise, and there were inaccuracies in the data I provided. Here's a link to a more accurate version. https://drive.google.com...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Bubufun

    Here is my solution for you, you can create a new column implementation in Power BI Desktop:

     

    Use power query add a column as the index value

     

    If the index value is less than or equal to the current index value and temp is 0, the maximum index value is returned

     

    max_index = CALCULATE (
        max ('Table'[Index] ),
        FILTER('Table', 'Table'[Index] <=EARLIER('Table'[Index]) && 'Table'[temp] = 0)
    )

     

     

    When temp is 0, it returns 0, and group_index when it is not equal to 0

     

    group_index = IF([temp] = 0, 0, [max_index])

     

     

    Temp sum for the same column value

     

    temp_value = SUMX(FILTER('Table', 'Table'[group_index] = EARLIER('Table'[group_index])), [temp])

     

     

    Determine whether the sum of values between 0 is greater than 1 and return the required value

     

    result = IF([temp_value] = 0, 0, if([temp_value] < 1, 0, if([temp_value] > 1, [temp])))

     

     

    Finally, you can make a report to show the result

     

     

    Best Regards,

    Nono Chen

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