Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a measure that calculates the average if only one value is selected from the drop down. if there are multiple values selected then calculate the average for each department individually and then add them together.
Following is the measure
Solved! Go to Solution.
[Your Measure] =
SUMX (
VALUES ( vwPowerBiData[DivisionName] ),
CALCULATE (
AVERAGE ( vwPowerBiData[ValueInUSD] ),
KEEPFILTERS(
NOT( vwPowerBiData[IsCurrentMonth] )
),
KEEPFILTERS(
vwPowerBiData[LineItemId] = 1
)
)
)
I'd kindly suggest you learn how to build correct models using star schemas and how DAX works. Without this knowledge, you'll be creating measures that you'll not understand and which will return incorrect values without you even noticing it. Your model is technically feasible but it's bad. Good models follow the principles of DIMENSIONAL DESIGN. And in DAX VARiables are... well, constant, so you can't change them once they've been declared.
Best
D
[Your Measure] =
SUMX (
VALUES ( vwPowerBiData[DivisionName] ),
CALCULATE (
AVERAGE ( vwPowerBiData[ValueInUSD] ),
KEEPFILTERS(
NOT( vwPowerBiData[IsCurrentMonth] )
),
KEEPFILTERS(
vwPowerBiData[LineItemId] = 1
)
)
)
I'd kindly suggest you learn how to build correct models using star schemas and how DAX works. Without this knowledge, you'll be creating measures that you'll not understand and which will return incorrect values without you even noticing it. Your model is technically feasible but it's bad. Good models follow the principles of DIMENSIONAL DESIGN. And in DAX VARiables are... well, constant, so you can't change them once they've been declared.
Best
D
Thank you. I cant thank you enough. I just couldnt understand why/how it would calculate properly for 3 months but then move to different one in the last one. But again thank you.
It's not clear everything that's going wrong here but this line is not doing what you think it is:
sumx(VALUES(vwPowerBiData[DivisionName]),SimpleAverage)
When you define a variable, it's treated as a constant when you reference it later. To calculate it differently for different DivisionNames, you'll need to make SimpleAverage a measure instead of a constant VAR.
I wish there was a way to "debug" the dax queries so I dont have to spent 6 hours on this thing.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 17 | |
| 8 | |
| 8 | |
| 7 |