Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi All,
I have created a DAX expression to calculate an average based on a division, my issue is to have the correct figures I need to remove from the calculation blank value, the only Solution that I found so far it is to use the filter pane and I would like to know if I can filter the value inside my DAX expression :
Test _ WH_Mesure =
VAR Numerator =
CALCULATE(
AVERAGE('Fact Table'[Value]),
FILTER(ALL(DimWHAttribute[Attribute]), DimWHAttribute[Attribute] = "Attribute A"
)
)
VAR Denominator =
CALCULATE(
AVERAGE('Fact Table'[Value]),
FILTER(ALL(DimWHAttribute[Attribute]), DimWHAttribute[Attribute] = "Attribute B"
)
)
VAR DivisionResult =
DIVIDE(Numerator, Denominator, 0)
RETURN
SWITCH(
TRUE(),
ISBLANK(DivisionResult) || DivisionResult = 0 || ISBLANK(Numerator) || ISBLANK(Denominator),
BLANK(),
DivisionResult
)
Hi @Fantmas if not already, check article https://www.sqlbi.com/articles/blank-handling-in-dax/ .
Keep in mind how DAX engine treat blank in functions like AVERAGE, link https://learn.microsoft.com/en-us/dax/average-function-dax .
It could be that you need to use AVERAGEX function. I hope this help.
Proud to be a Super User!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
7 | |
6 | |
5 |
User | Count |
---|---|
20 | |
14 | |
10 | |
9 | |
6 |