Search code examples
filterpowerbidaxpowerbi-desktopmeasure

Needing a field filtered 3 ways ways for a line chart


I'm not really sure how to implement a filter on a new measure I create. The documentation doesn't really fall into my use case. I can create a measure like this

ResolutionPercetage = DIVIDE(DISTINCTCOUNT(qry_Resolutions[WO#]),DISTINCTCOUNT(qryWorkOrders_AllTables[WO#])) 

But I can't add the filter to this measure to make it specific to a region.


Solution

  • This works on my example data. You should use FILTER inside CALCULATE.

    ResolutionPercetage = 
    DIVIDE (
        CALCULATE (
            DISTINCTCOUNT(qry_Resolutions[WO#]),
            FILTER(qry_Resolutions, [Region] = 5 )),
        CALCULATE (
            DISTINCTCOUNT(qryWorkOrders_AllTables[WO#]),
            FILTER(qryWorkOrders_AllTables, [Region] = 5 )) )
    

    qry_Resolutions:
    enter image description here

    qryWorkOrders_AllTables:
    enter image description here

    Result:
    enter image description here