March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |