Forum Discussion

rashel2002's avatar
rashel2002
Icon for Helper II rankHelper II
8 years ago
Solved

Calculated table which is change dynamically according to slicer selection

Hi all :)   lets say i have a database table, which describe me for each task - on what WW it happened and how many hours took for it to be done. also, for each task it tells me the priority of the...
  • TomMartens's avatar
    8 years ago

    Hey,

     

    here you will find a little pbix file

     

    Basically it's just necessary to calculate the cumulative of value of the working hours, due to the nature of Power BI and how the filtering works one does not need to create a sum for "basic" working hours.

     

    But to achieve the "stepped" visual if just priority 1 is selected, it's necessary to create an additional table, that contains all the unique values from the WW column. In my example I named this table just "WW". There is a relationship between both tables on the one side the new "WW" table and on the many side the table that contains the data. This is a recommended approach and becomes much more important if your data will contain data / datetime columns.

     

    Be aware that all the visuals are using the WW column from the WW table.

     

    Here is a screenshot from showing the line chart with just Priority 1 filtered:

     

    Here is the DAX statement that I use to calculate the measure that shows the cumulated Working Hours:

    **bleep** No. of hours = 
    CALCULATE(
        SUM('Table1'[No. of hours])
        ,FILTER(
            ALL('WW'[WW])
            ,'WW'[WW] <= MAX('WW'[WW])
        )
    ) 

    Hopefully this is what you are looking for.

     

    Regards

    Tom