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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
PM_2078
New Member

Using IF statement in DAX

Hello, having an issue trying to figure this out.  I am trying to recreate an IF statement in Power BI using DAX.  I have the IF measure created, but not exactly sure how to SUM the result of the IF measure.  

I have Products listed, Store A Volume and Store B Volume.  

My IF measure is:  IF([Total Store B Volume] > [Total Store A Volume], [Total Store B Volume], [Total Store A Volume])

I am looking to SUM the Revised Volume Column.  Currently the total is 302, but I need it to reflect the Revised Amount total which is 57, not 302.

Can someone direct me on how to accomplish? 

ID                      Store A Volume           Store B Volume Revised           Volume(IF)
9999 Dates        40                                59                                             40
9999 Banana      4                                  7                                               4
9999 Carrot        7                                  3                                               3
9999 Apple        2                                  4                                                2
9999 Orange      2                                  3                                               2
9999 Lentils        1                                 2                                                1
9999 Broccoli      52                               1                                                1
9999 Corn          4                                  1                                                1
9999 Pepper       2                                 1                                                1
9999 Cucumber  1                                 1                                               1
9999 Mint           1                                 1                                               1
9999 Potato        0                                 1
9999 Squash       0                                 1
9999 Turnip                                           1
9999 Cabbage    3
9999 Onion                                            1
9999 Celery                                            5
9999 Cauliflower                                    69
9999 Kale                                                1
9999 Lettuce                                           1
                         119                              163                                       57

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PM_2078 

 

As I understand it, your "Total Store A Volume" and "Total Store B Volume" are two measures. Here is my trying.

 

Total Store A Volume and Total Store B Volume:

Total Store A Volume = SUM([Store A Volume])

 

Total Store B Volume = SUM([Store B Volume])

 

Then I created a measure as follows.

Revised Volume Total = 
SUMX(
    'Table', 
    IF(
        [Total Store B Volume] < [Total Store A Volume], 
        [Total Store B Volume], 
        [Total Store A Volume]
    )
)

 

Result:

vxuxinyimsft_0-1711074438636.png

 

Best Regards,
Yulia Xu

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @PM_2078 

 

As I understand it, your "Total Store A Volume" and "Total Store B Volume" are two measures. Here is my trying.

 

Total Store A Volume and Total Store B Volume:

Total Store A Volume = SUM([Store A Volume])

 

Total Store B Volume = SUM([Store B Volume])

 

Then I created a measure as follows.

Revised Volume Total = 
SUMX(
    'Table', 
    IF(
        [Total Store B Volume] < [Total Store A Volume], 
        [Total Store B Volume], 
        [Total Store A Volume]
    )
)

 

Result:

vxuxinyimsft_0-1711074438636.png

 

Best Regards,
Yulia Xu

 

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

lbendlin
Super User
Super User

What's the reason for using measures?  Is the Total Store volume impacted by user filters?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.