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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Filter IF...

Hello!

I have this dax code,

 

I need the meassure to Sum all the SO Net ( [SO Net] is a meassure = Calculate(Sum(POS DB'[SO Net)) ) of all the rows that say "Stock" ( 'POS DB'[Stock] ) but if it says "No Stock" only Sum [SO Net] <= 25000

So Only sum [SO Net] <=25000  if it says No Stock, otherwise Sum even if [SO Net] is > than 25000

 

The meassure should be calculated a level by Year, Quarter,  Product Group, End User Country, and finally End User (That is why I used the Summarize function in the code below.

 

Can you help me please??!!

 

Meassure =
SUMX (
    FILTER (
        SUMMARIZE (
            'POS DB',
            'POS DB'[Year],
            'POS DB'[Quarter],
            'POS DB'[Product Group],
            'POS DB'[End User Country],
            'POS DB'[End User Name]
        ),
        [SO Net] <= 25000
    ),
    [SO Net]
)

6 REPLIES 6
MFelix
Super User
Super User

Hi @Anonymous ,

 

The question is that you are not adding the value on the table summarization so you are not filtering the values you need try the following code.

 

Meassure =
SUMX (
    FILTER (
        SUMMARIZE (
            'POS DB',
            'POS DB'[Year],
            'POS DB'[Quarter],
            'POS DB'[Product Group],
            'POS DB'[End User Country],
            'POS DB'[End User Name],
            "@SONET", [SO Net]
        ),
        [@SONET] <= 25000
    ),
    [@SONET]
)

 

Be aware that I'm assuming that by the format [SO Net] is a measure in your model.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Anonymous
Not applicable

Mfelix thanks for you time and response

Indeed, [So Net] is a meassure

How can I Filter IF??

I need the meassure to Sum all the SO Net ([SO Net]) of all the rows that say "Stock" ( 'POS DB'[Stock] ) but if it says "No Stock" only Sum [SO Net] <= 25000

So Only sum [SO Net] if it says Stock, otherwise Sum even if it is > than 25000

 

Hi @Anonymous ,

 

Since you need to do addtionall filtering on your data based on a column that is not on the summarize can you please share some sample data?


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





selimovd
Most Valuable Professional
Most Valuable Professional

Hey @Anonymous ,

 

how is the relationship between the tables 'DB' and 'POS DB'?

If we should filter if 'DB'[Stock] says "Stock" or "No Stock" we need to know how these tables are connected and also how the data looks like.

 

Make it easy for us and we can help you.

 

Best regards

Denis

Anonymous
Not applicable

Hi! Sorry for my mistake, I just edited the post... Its all the same data base. Sorry!

aj1973
Community Champion
Community Champion

Hi @Anonymous 

Your request is missing information!

Can you share a sample Pbix?

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors