Forum Discussion

pratiwari17's avatar
pratiwari17
Regular Visitor
2 years ago
Solved

First Quartile calculation in Power BI

Hi , I have a dataset where i am calculating Energy Use Index and i want a card metric to calculate First Quartile of Energy Use Index.  Please provide me a way to calculate it. I have location, area of the location and Energy Use Index is total energy consumption / total area and we have a year filter. Data Source is databricks and mode is Direct Query mode. 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi pratiwari17 ,

    I create a table as you mentioned.

    Then I use a measure and show the result on the card visual.

    EUI_First_Quartile = 
    CALCULATE(
        MEDIANX(
            TOPN(
                ROUNDUP(DIVIDE(COUNTROWS('YourTable'), 2), 0),
                'YourTable',
                'YourTable'[EUI_Column_Name],
                ASC
            ),
            'YourTable'[EUI_Column_Name]
        ),
        ALLSELECTED('YourTable')
    )
    

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi pratiwari17 ,

    I create a table as you mentioned.

    Then I use a measure and show the result on the card visual.

    EUI_First_Quartile = 
    CALCULATE(
        MEDIANX(
            TOPN(
                ROUNDUP(DIVIDE(COUNTROWS('YourTable'), 2), 0),
                'YourTable',
                'YourTable'[EUI_Column_Name],
                ASC
            ),
            'YourTable'[EUI_Column_Name]
        ),
        ALLSELECTED('YourTable')
    )
    

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.