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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Power BI Desktop - DAX Issue

Dear Team,

In DAX calculation, I found one weird case, just wanted to filter the data on some condition.

 

Here is the DAX that was written -

CALCULATE(SUM(FactTotal[Sales]), FILTER(FactTotal, FactTotal[Key] = 1))

It was returning incorrect data.

 

But when I changed this to different DAX without FILTER word -

CALCULATE(SUM(FactTotal[Sales]), FactTotal[Key] = 1)

It works fine.

 

Could anyone please suggest, what went wrong with the first statement.

 

Thanks,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

It's the way DAX works internally. Your second function:

CALCULATE(SUM(FactTotal[Sales]), FactTotal[Key] = 1)

is really

CALCULATE(
    SUM( FactTotal[Sales]),
    FILTER(
        ALL(FactTotal),
        FactTotal[Key] = 1
    )
)

so all removes the current filters and applies you FactTotal[Key] = 1 filter.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

It's the way DAX works internally. Your second function:

CALCULATE(SUM(FactTotal[Sales]), FactTotal[Key] = 1)

is really

CALCULATE(
    SUM( FactTotal[Sales]),
    FILTER(
        ALL(FactTotal),
        FactTotal[Key] = 1
    )
)

so all removes the current filters and applies you FactTotal[Key] = 1 filter.

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.

Top Solution Authors