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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Calcuate DAX help

I have two measures 

Example:

One is calculate(sum(value), filter(Table,table.source="a")

Another measure is calculate (sum(value),filter( table.table.source="b")

 

these measures are displaying in tabluar report.

 

state - Measure 1 ,Measure2

 

Also ,at the same time . The user  asking a slicer ( tablea.date),that should required in the report which should filter only Measure2 values ,not measure1 value.

 

How to avoid slicer - filter values that should not pass to measure1 values? What is the best DAX for calucating the measure 1 ?

 

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Using all will clear all context filtering conditions.

Choosing to use all or allexcept depends on the results you expect.

There is only one state where you can choose to use all.

Measure = CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),'Table'[source]="a"))

There are several states that can choose to use allexcept

Measure = CALCULATE(SUM('Table'[value]),FILTER(ALLEXCEPT('Table','Table'[state]),'Table'[source]="a"))

 

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

View solution in original post

6 REPLIES 6
FarhanAhmed
Community Champion
Community Champion

Try use ALL(Table) with your measure 1. This will exclude any external filter applied on measure.

If you want certain external filters to be applied on measure then use ALLEXCEPT (Table, [filtercolumn1],[filtercolumn2]... etc)....

 

calculate(sum(value), filter(All(Table),table.source="a")

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




amitchandak
Super User
Super User

@Anonymous , refer if these can help

Measure 1 new = calculate([Measure 1], all(tablea[Date]))
Measure 1 new = calculate([Measure 1], removefilters(tablea[Date]))

 

Refer
https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

allexecpt not working.

Measure1 -

 

Sample

SourceProcess DateValueState
ABlank2001
B03/30/20203001
B04/30/20204001

 

Report: when slicer applied on Process Date (exmple value 04/30/2020) ,the report should show like below

the Source A values should not filtered out based on process date

 

SourcestateValue
A0120
B0140

 

Source 

Hi @Anonymous ,

 

Is this problem sloved?
If not, please let me know.

 

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

Hi @Anonymous ,

 

Using all will clear all context filtering conditions.

Choosing to use all or allexcept depends on the results you expect.

There is only one state where you can choose to use all.

Measure = CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),'Table'[source]="a"))

There are several states that can choose to use allexcept

Measure = CALCULATE(SUM('Table'[value]),FILTER(ALLEXCEPT('Table','Table'[state]),'Table'[source]="a"))

 

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

Greg_Deckler
Super User
Super User

@Anonymous - You will need to use ALLEXCEPT in order to exclude certain filters from affecting your measure. Would be easier to be specific with sample data and expected output:

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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