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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Calculate and Sum with Wildcard

Hi there

is there a possibility to set a sum from a filter with wildcard using DAX?

I have a list of accounts.
I want to sum the accounts >=10xx* and <=109x*.
The accounts are formatted as numeric fields.
Without a wildcard the filter works, but the accounts are dynamic, so I am looking for a solution to make it so.

 

CALCULATE(
    SUM('TBL'[Sales]),
    FILTER(ALL(TBL[Accounts]),TBL[Accounts] >=10* && <=109*)
)
 
Thanks for a Tipp
Regards,
1 ACCEPTED SOLUTION

@Greg_Deckler correct, i find a way for this

 

CALCULATE(
SUM('TBL'[Bewegung]),
FILTER(ALL(TBL[Konto]),TBL[Konto] >=1000 && TBL[Konto] <=1099 && TBL[Konto] >=10000 && TBL[Konto] <=10999)
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

@thebeginner1204 
Please provide sample data along with the expected result.

@tamerj1 sure, here:

 

Printscreen.png

 

The following list contains accounts (Columm "Konto") which have to be calculated separately.
Marked red refers to the question in this case.
The filter should sum up all values in the column "Bewegung" which are either >=1000 <=1099 or >=10000 <= 10999 in the column "Konto", i.e. either between 1000 and 1099 or between 10000 and 10999.

This is how I tried it, the formula works, but the result is 0.

 

This is how I tried it, the formula works, but the result is 0.

 

CALCULATE(
SUM('TBL'[Bewegung]),
FILTER(ALL(TBL[Konto]),TBL[Konto] >=1000 && TBL[Konto] <=1099 && TBL[Konto] >=10000 && TBL[Konto] <=10999)
)

Greg_Deckler
Super User
Super User

@thebeginner1204 Well, you don't need the * for the >10. Perhaps pick a reasonable maximum for the other? 109999?


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler correct, i find a way for this

 

CALCULATE(
SUM('TBL'[Bewegung]),
FILTER(ALL(TBL[Konto]),TBL[Konto] >=1000 && TBL[Konto] <=1099 && TBL[Konto] >=10000 && TBL[Konto] <=10999)
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors