Forum Discussion

Humblelistener's avatar
Humblelistener
Icon for Microsoft Employee rankMicrosoft Employee
6 years ago
Solved

In a table after merged query, replace null column value with an existing value for an entity?

In Power BI Desktop, I've merged a two queries:   1) Building statistics over time 2) KPI metrics for each building but only contains recent data.   What I'm trying to accomplish is use the KPI ...
  • mwegener's avatar
    mwegener
    6 years ago

    Hi Humblelistener ,

     

    In the score query, the steps create a numeric column YEAR-QTR

     

    Similarly, I create the same column YEAR-QTR in the Building Stats query

     

    Merge the two queries using the BUILDING column...

     

    ...and expand the Scores YEAR-QTR.

     

    The conditional column marks the relevant rows, where the Building Stats.YEAR-QTR <= Scores.YEAR-QTR

     

    Than you can filter on the relevant rows.

    Group the rows to get the last/nearest Scores.YEAR-QTR

     

    Now you can merge the two queries related to the BUILDING and (the latest) Scores.YEAR-QTR columns.

    Expand Scores column to get the Score value

     

    Regards,

    Marcus

    Dortmund - Germany
    If I answered your question, please mark my post as solution, this will also help others.
    Please give Kudos for support.