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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sania-F
Resolver I
Resolver I

VALUES function with HASONEVALUE and SUMX iterator function

sales commission iterator =
SUMX(
    VALUES('Sales Territory'[Region]),
    CALCULATE(
        [Revenue]
        * IF(
            VALUES('Sales Territory'[Country]) = "United States",
            0.15,
            0.1
        )
    )
)
----------------------------------------------------------------------------------
sales commission = [Revenue] *
if(HASONEVALUE('Sales Territory'[Country]),
 IF(VALUES('Sales Territory'[Country]) = "United States", 0.15,0.1))
-----------------------------------------------------------------------------------
  • Iterator version = correct when multiple values exist, because it loops through each row and applies the right logic.

  • Simple version = works only when the filter context guarantees one country at a time. If multiple exist, it miscalculates.


  • In sales commission iterator, SUMX iterates through each region, evaluates [Revenue] * 0.1, then sums up.

  • In sales commission, you’re multiplying the total [Revenue] in context by 0.1.


Rule of thumb:

  • Use simple measure if your business rule applies a single rate per filter context.

  • Use iterator (SUMX) when you need row-by-row logic, e.g., different commission rates for different countries/products.

2 REPLIES 2
v-sdhruv
Community Support
Community Support

Hi  @Sania-F ,
Thank you for sharing this. This kind of post is incredibly valuable to the community. Consider turning this into a blog post so others can benefit from your experience more easily
Power BI Community Blog - Microsoft Fabric Community


Thank You!

FBergamaschi
Solution Sage
Solution Sage

This is a blog for asking for support, if you want to explain DAX you can consider other blogs

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.