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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
shei7141
Helper III
Helper III

Dax multiple conditional sum

Hi guys,

 

I have a table which looks like this:

StorePhasesEstimated cost
J&JA1
J&JB 
J&JC2
J&JD3
TimLeeA5
TimLeeB3
TimLeeC 
TimLeeD1

In all the cases, if estimatedCost of B is blank C will have some estimated cost or if B has some cost the C will be blank

 

I have slicer where user can select any store name

I want to create a MEASURE which can do a conditional sum based on the following conditions:

1: if Phase B's estimated cost is blank measure = 1 otherwise measure = 2

 

Any pointers will be greatly appreciated 🙂

 

Ta

Shei

 

1 ACCEPTED SOLUTION

Yes, a MEASURE does not have the row context of the table. You can try two options:

Option A:
Use SUMX(Table, IF( insert your formula here)

Option B:
Use the SELECTEDVALUE function around any column you want to reference. This will only return a value if there is 1 value for the selected column, so requires a specific table configuration.

I prefer Option A in this case.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

Not totally sure on what you are looking for but you can make a table visual with your Store column and this measure.  It will show 1 if the B value for that store is blank (and 2 if not).

 

B Blank = IF(ISBLANK(CALCULATE(MIN(Table[Estimated Cost]), Table[Phases] = "B")), 1, 2)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


AllisonKennedy
Super User
Super User

Not sure what the problem is? What formula do you want to use for Measure =1 and measure=2?

What configuration do you want to have in the final table display?

A simple IF or SWITCH should do what you want, unless you have a complex table configuration, then you may need to start looking at ALL or other similar options.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Thank mate

I am having trouble with referencing table's columns in a measure. In excel, I would have said,

if(and(Phase = "B",Estimate Value >0), 1, 2)

 

It is a simple tab and simple if and condition but I am struggling to define it as a measure.

 

Ta

Shei

 

Yes, a MEASURE does not have the row context of the table. You can try two options:

Option A:
Use SUMX(Table, IF( insert your formula here)

Option B:
Use the SELECTEDVALUE function around any column you want to reference. This will only return a value if there is 1 value for the selected column, so requires a specific table configuration.

I prefer Option A in this case.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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