Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I'm having trouble creating a measure that will behave in the following manner:
Existing Measures(#) > If the sum of that measure for each month is > 2000 then limit to 2000, else if < -2000 then limit to -2000 > Find the Sum based on the given date slicer and visual context
To my understanding, I need some way to calculate the of each month with the [NetRevenue wLimit] applied before it aggregates by Yearmonth. I'm not sure how to achieve this behavior. The examples below show I get the expected result when only one month is selected, but when I add multiple months in my date slicer the measure doesn't behave as desired.
My guess is I need to use some type of iterator function(SUMX...), but I can't get anything to work.
Expected Result: (Month Date Slicer)[June and July Selected]
SalesRepName | Net Revenue $ | NetRevenue wLimit |
Bob | 200 | 200 |
Susan | -4000 | -3000 |
What I getting instead [Month Date Slicer](June and July Selected)
SalesRepName | Net Revenue $ | NetRevenue wLimit |
Bob | 200 | 200 |
Susan | -4000 | -2000 |
If I expand the table to include year month the evaluated table looks like the following
SalesRepName (Column) | YearMonth(Column) | Net Revenue $ (Measure) | NetRevenue wLimit (Measure) |
Bob | 202106 | -1 | -1 |
Bob | 202107 | 201 | 201 |
Susan | 202106 | -1000 | -1000 |
Susan | 202107 | -3000 | -2000 |
Measure Definitions:
Net Revenue $ = ([Ending Book] - [Starting Book])
*Note [Ending Book] and [Starting Book] are both calculated measures using the credits table
NetRevenue wLimit =
VAR MC =
CALCULATE (
SUM ( Credits[Amount] ),
Credits[Credit Type] = "Management Change Add"
|| Credits[Credit Type] = "Management Change Add Term"
|| Credits[Credit Type] = "Management Change Drop Term"
|| Credits[Credit Type] = "Management Change Drop"
)
RETURN
IF ( MC > 2000, 2000, IF ( MC < -2000, -2000, MC ) )
Model:
Other information:
Salesrepname sourced from the historical salesroletable
Yearmonth is from the Dimension vw_Date table
Solved! Go to Solution.
Yeah, the idea is to iterate at the level of granularity that your limit rules apply. It will look something like this:
Revenue with Limit =
SUMX (
ADDCOLUMNS (
SUMMARIZE (
Credits,
Credits[SalesRepName],
vw_Date[YearMonth]
),
"@MC", [MC Limit]
),
[@MC]
)
Yeah, the idea is to iterate at the level of granularity that your limit rules apply. It will look something like this:
Revenue with Limit =
SUMX (
ADDCOLUMNS (
SUMMARIZE (
Credits,
Credits[SalesRepName],
vw_Date[YearMonth]
),
"@MC", [MC Limit]
),
[@MC]
)
Thank you @AlexisOlson. Could you explain what the "@" simple means and where I can learn more about iterator functions?
The @ symbol is just a naming convention for a temporary column. It's not an operator or special symbol. You could remove it and it wouldn't change how the measure works.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
48 | |
41 | |
34 |
User | Count |
---|---|
164 | |
112 | |
62 | |
54 | |
38 |