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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Javif84
New Member

Average for just a dimension excluding all the others

Hi 

I need some help

See the dataset https://we.tl/t-dKuv7RRhyT 

 

What I want to do is that indepentently what dimension I select i get the average of the dimension Rating that has 4 values C1/C2/C3 and C4

Moreover I want this formula to select the average of only the values where we have sales andt not null data.

The average needs to be done on a metric that i created called  [UNit SOld] as 

 

So my DAX formula is

average = VAR CurrentRating = SELECTEDVALUE(Sales[Rating])

return
if(
    CurrentRating IN {"C1","C2","C3","C4"},
calculate(averagex(Sales,Sales[Units Sold]),
ALLEXCEPT(sales,Sales[Rating]),
Sales[Rating] in {"C1""C2""C3","C4"}))
 
It is not correct as it is making me the average for the field AM and this is not correct as I want te formula to give an average for each one of the ratings C1, C2, C3 and C4 independently of the customer buyer name, AM, ABM and all the other fields. And moreover I need to exclude all the rows with a blank value. See my example in the excel
 
I do not achieve that, I tried with analyst chatGTP and don t get it neither
Please help
 
1 ACCEPTED SOLUTION

Hi @Javif84 ,

Thank you for reaching out to us on the Microsoft Fabric Community Forum.

Once try this measure:


Average_Units_Sold =
CALCULATE(
AVERAGEX(
FILTER(
ALL(Sales),
Sales[Rating] IN {"C1", "C2", "C3", "C4"} && NOT(ISBLANK(Sales[Units Sold]))
),
Sales[Units Sold]
)
)

If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.

View solution in original post

9 REPLIES 9
Javif84
New Member

No, te topic is not solves yet 😞

 

Thanks for asking

Hi @Javif84 ,

Thank you for reaching out to us on the Microsoft Fabric Community Forum.

Once try this measure:


Average_Units_Sold =
CALCULATE(
AVERAGEX(
FILTER(
ALL(Sales),
Sales[Rating] IN {"C1", "C2", "C3", "C4"} && NOT(ISBLANK(Sales[Units Sold]))
),
Sales[Units Sold]
)
)

If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.

Hi @Javif84 ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi @Javif84 ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

Hi @Javif84 ,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.


Thank you.

pankajnamekar25
Super User
Super User

@Javif84 ,

 

Please try this

Average_Units_Sold =
CALCULATE(
AVERAGEX(
FILTER(Sales, NOT(ISBLANK(Sales[Units Sold]))),
Sales[Units Sold]
),
KEEPFILTERS(Sales[Rating] IN {"C1", "C2", "C3", "C4"}),
REMOVEFILTERS(Sales[AM], Sales[ABM], Sales[Customer Buyer Name])
)

 

Thanks,
Pankaj

If this solution helps, please accept it and give a kudos, it would be greatly appreciated.

pankajnamekar25
Super User
Super User

Hello @Javif84 

 

You can try this DAX Measure

Average_Units_Sold =

VAR CurrentRating = SELECTEDVALUE(Sales[Rating])

 

RETURN

IF(

    CurrentRating IN {"C1", "C2", "C3", "C4"},

    CALCULATE(

        AVERAGEX(

            FILTER(Sales, NOT(ISBLANK(Sales[Units Sold]))), 

            Sales[Units Sold]

        ),

        ALLEXCEPT(Sales, Sales[Rating])

    )

)

Thanks,
Pankaj

If this solution helps, please accept it and give a kudos, it would be greatly appreciated.

But I have the same problem 

 

I do not have a unique value for C1, it changes depending on the selection of AM/ABM and Customer Buyer Name

 

Javif84_0-1742982785011.png

 

Hi @Javif84 ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.