Forum Discussion

tonijj's avatar
tonijj
Helper IV
1 year ago
Solved

KPI Percentage difference - discard empty values

Hi,  Question 1: Im trying to create a KPI that shows Percentage difference for two RFPs.    However, what I want the KPI to do, is to Only compare products that both have in their portfolio and...
  • wardy912's avatar
    1 year ago

    Hi tonijj 

     

    Question 1:

     

    try this measure

    KPI_PercentageDifference (%) :=
    AVERAGEX(
        FILTER(
            Products,
            Products[WalmartPrice] > 0 &&
            Products[PublixPrice] > 0
        ),
        ABS(Products[WalmartPrice] - Products[PublixPrice]) /
        DIVIDE((Products[WalmartPrice] + Products[PublixPrice]), 2)
    ) * 100

     

    You could also do this in power query, setting up a calculated column to show 'true' if both values are present, 'false' if one is missing, then filter false

     

    = if [WalmartPrice] = null or [PublixPrice] = null or [WalmartPrice] = 0 or [PublixPrice] = 0 then true else false

     

    Question 2:

     

    Power query is the easiest place to replace values, select 'transform data', go to the table you need, right click the column and select 'replace values'.

     

     

    If this helps please give a thumbs up and mark as the solution, thanks.