Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
2 years ago

Display Sum per Row

Hi Good day,

Can anyoune pls need help on my calculated column, i want to display the sum of remaining per row, pls refer below.  my cuurent calculated column. The remainig value are coming from Tb1, the calculated column is in Tb2.

 

Sum of Remaining = SUM(BRUNEI_WTI_PROGRESS_YRLY_sql[Remaining hours])

 

REMAINING_HRS =
    CALCULATE(
            [Sum of Remaining],
                    FILTER(
                        ALL(BRUNEI_WTI_PROGRESS_YRLY_sql[Sub-Task Phase]),
                        BRUNEI_WTI_PROGRESS_YRLY_sql[Sub-Task Phase] IN { "SN-10 Punchlist", "SN-11 Punchlist", "CBD-06", "PRE CPRA_WJ43", "CP-276", "CBD-09", "FL-06", "FL-09", "SN-05 Punchlist", "SN-08 Punchlist", "PRE CPRA_DP31", "SN-03 Punchlist", "SN-07 Punchlist", "2nd PRE CPRA", "02 CW-AY PRE DRILL FL"}),
                       
                    FILTER(
                        ALL(BRUNEI_WTI_PROGRESS_YRLY_sql[Main Cat.]),
                         BRUNEI_WTI_PROGRESS_YRLY_sql[Main Cat.]= "Q"))

What i want is:

 

my table

Thank you


 

4 Replies

    • AllanBerces's avatar
      AllanBerces
      Post Prodigy

      Hi DataNinja777 

      Thank you for your reply, but the caculated column you created is in Tb1. I want it in Tb2 hence the EARLIER function can access the ( BRUNEI_WTI_PROGRESS_YRLY_sql[Sub-Task Phase] ). Any other way to have the output i desire.

       

      Thank you

  • AllanBerces 

    To display the sum of remaining hours per row in Power BI, you can use the following DAX formula for your calculated column in Tb2:

    REMAINING_HRS = 
    CALCULATE(
        SUM(Tb1[Remaining hours]),
        FILTER(
            ALL(Tb1),
            Tb1[Sub-Task Phase] IN { "SN-10 Punchlist", "SN-11 Punchlist", "CBD-06", "PRE CPRA_WJ43", "CP-276", "CBD-09", "FL-06", "FL-09", "SN-05 Punchlist", "SN-08 Punchlist", "PRE CPRA_DP31", "SN-03 Punchlist", "SN-07 Punchlist", "2nd PRE CPRA", "02 CW-AY PRE DRILL FL"}
            && Tb1[Main Cat.] = "Q"
        ),
        Tb1[Date] = EARLIER(Tb2[Date])
    )

    This formula sums the Remaining hours from Tb1 for each corresponding Date in Tb2. It filters Tb1 to include only the rows where Sub-Task Phase matches any of the specified values and Main Cat. is “Q”. The EARLIER function is used to refer to the Date column of the current row in Tb2 within the CALCULATE function.

    Please ensure that there is a relationship between Tb1 and Tb2 based on the Date column for this formula to work correctly. If there are any further details or specific requirements, feel free to provide them for more tailored assistance.

    • AllanBerces's avatar
      AllanBerces
      Post Prodigy

      Hi, AnalyticsWizard 

      Thank you for the reply, but when I try the formula you provided it sum the overall remaining of all sub task phase and display the value on specific date. pls refer below for the output.

       

       

      Thank you