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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sirros_iot
Helper IV
Helper IV

Average by ID

Hello All!

 

It seems like very easy but I'm having trouble with it. OBS: I'm getting the data by live concection( Importing dataset from power BI online)

The table I have
ID                 Value   
1                      5
2                      2
1                      3
2                      6          

What I want with the measure
ID                 Value             measure
1                      5                      4
2                      2                      5
1                      3                      4
2                      8                      5

I tried to use quick measures but It didn't return me te right thing

 

Best Regards,

Diego 

7 REPLIES 7
sirros_iot
Helper IV
Helper IV

Thank you for the answers,

@parry2k is returning by ID but the average isn't right...

@danextian is returning the right average but it isn't by ID...

I'll look where I can put both answers together to solve this issue.

Thanks,

Best Regards,

Diego

@sirros_iotif you put Id and this new measure in a table view, I expect the result to be correct. Could you share what result you are getting? Why it is not correct?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Sean
Community Champion
Community Champion

@sirros_iot

This should do it (and should work as a column too)

 

Measure =
CALCULATE ( AVERAGE ( Table1[Value] ), ALLEXCEPT ( Table1, Table1[ID] ) )

 

@parry2k's solution works too.

But why write so much? Smiley Very Happy

Hello all! The filter by ID is working!

I think I know the problem about that measure that was calculating by ID right... I have page filters that take out some data.

I would have to filter this measure, when I tried to do it, it stop working right.

Exemple of the measure...  and my table... ID = sensor                                 The correct answer for .Avg would be 8.625

.Avg = 
CALCULATE ( AVERAGE ( RealTimeData[intervalo] ); ALLEXCEPT ( RealTimeData; RealTimeData[sensor] ))]

Responder1.PNG

I would like to do something lke this..

.Avg = 
CALCULATE ( AVERAGE ( RealTimeData[intervalo] ); ALLEXCEPT ( RealTimeData; RealTimeData[sensor] ); FILTER( RealTimeData; RealTimeData[contagem] > 1))

But it returns me...
responder2.PNG

Sorry anything, @Sean@parry2k@danextian
Best Regards,
Diego

I just saw that in the total I have the correct answer!

Someone knows what is the problem?

 

Thanks,

Diego

danextian
Super User
Super User

Hi @sirros_iot,

 

Try this:

 

avg by id =
CALCULATE (
AVERAGEX ( ALL ( 'Table'[ID] ), AVERAGE ( 'Table'[Value] ) ),
ALLEXCEPT ( 'Table', 'Table'[ID] )
)









Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
parry2k
Super User
Super User

You need to add a measure to something like this

 

Measure = var m = FIRSTNONBLANK(Table1[id], "") 
return CALCULATE(AVERAGE(Table1[value]), FILTER(ALLSELECTED(Table1),m =Table1[id]))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.