Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
xariet
Helper I
Helper I

Calculate with combined filters

Hi All

I need to calculate the median price for the year 2022 Q2. I have the following measure which doesn't work 

Med Price for Q2 2022 = CALCULATE(MEDIAN('output for power BI'[Price]), year('output for power BI'[Date])=2022, QUARTER('output for power BI'[Date]= 2))
I have tried another calculation as well, but it didn't work either
Med Price for Q2 2022 = CALCULATE(MEDIAN('output for power BI'[Price]), year('output for power BI'[Date])=2022 &&  QUARTER('output for power BI'[Date]= 2))
I am getting the result in the report where the price is showing for Q1 and Q2 2022. How do I get the price only for Q2 2022?
xariet_0-1670546057908.png

thank you 

UPDATE:

 

I have changed my date, Instead of auto date which I was using before I now use Calendar Table. And the output I am getting is different, but still not correct. In my report I need to see number $440 not $435. What is wrong here?

 

xariet_0-1670550732459.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @xariet,

Perhaps you can try to add them into the filter function to calculate with current filter effects:

Med Price for Q2 2022 =
CALCULATE (
    MEDIAN ( 'output for power BI'[Price] ),
    FILTER (
        ALLSELECTED ( 'output for power BI' ),
        YEAR ( [Date] ) = 2022
            && QUARTER ( [Date] ) = 2
    )
)

If the above also don't help, please share some dummy data and more detailed information to help us clarify your scenario and test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI @xariet,

Perhaps you can try to add them into the filter function to calculate with current filter effects:

Med Price for Q2 2022 =
CALCULATE (
    MEDIAN ( 'output for power BI'[Price] ),
    FILTER (
        ALLSELECTED ( 'output for power BI' ),
        YEAR ( [Date] ) = 2022
            && QUARTER ( [Date] ) = 2
    )
)

If the above also don't help, please share some dummy data and more detailed information to help us clarify your scenario and test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

thank you @Anonymous , your solution worked!

xariet
Helper I
Helper I

thank you @vicky_ , removing the bracket didn't help

vicky_
Super User
Super User

This might be a typo issue. Check that the last part of that formula is changed from:  

QUARTER('output for power BI'[Date]= 2))
to
QUARTER('output for power BI'[Date])= 2) 

(basically just change the brackets a bit)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.