Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Filter _ slicer _ line chart

  Hi Guys, having this table: Title Period  Mileage per period Incident name   1 1000 Incident name2   1 1000 Incident name3   2 1503 Incident name4   3 1111 Incident na...
  • PaulOlding's avatar
    4 years ago

    Hi Anonymous 

    Calculated columns aren't dynamic in Power BI.  That is, slicer selections do not affect the values in them as they are not recalculated.

    Measures are dynamic, so that's what to use.

    Here's a measure to get the values.  You may want to think about what value should be displayed at the total level.  That isn't specified in your question

    incident per period value = 
    VAR _MileagePerPeriod = 
    ADDCOLUMNS(
        SUMMARIZE(
            Incidents,
            Incidents[Period],
            Incidents[ Mileage per period]
        ),
        "@Rows", CALCULATE(COUNTROWS(Incidents))
    )
    VAR _Result = SUMX(_MileagePerPeriod, DIVIDE(Incidents[ Mileage per period], [@Rows]) )
    RETURN
        _Result