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
ovinasca
Frequent Visitor

Measure aggregated based on dimensions

Hi all!

 

I need to create a measure that aggregates based on dimensions, I mean, when its aggregated by the Time Dimension I need to SUM the values but when its aggregated by the Department Dimension I need to AVERAGE the values.

 

Thanks in advanced.

Regardsfte_ex.jpg

1 ACCEPTED SOLUTION

@ovinasca

 

Hi, try with this Measure in Values Section

 

Measure =
IF (
    HASONEVALUE ( Table1[TIME] );
    SUM ( Table1[FTE's] );
    AVERAGE ( Table1[FTE's] )
)

Regards

 

Victor

Lima - Peru

 

 

 




Lima - Peru

View solution in original post

16 REPLIES 16
v-jiascu-msft
Employee
Employee

Hi @ovinasca,

 

Can you share a sample please? In other words, can we take the non-total values as the original data?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes it is!

 

The non total values are the original data and the total values should be the aggregation output depending on the dimension. 

 

The picture shows what would be the final result

 

Thanks!!!

 

 

Greg_Deckler
Super User
Super User

So, does that represent source data, expected output, neither, both?

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Sorry and thanks for the post you suggested!!!

 

The pìcture shows what should be the final result. We have a measure called FTE's with two dimensions, WEEK and DEPARTMENT.

 

I want the values of FTE's to be aggregated as SUM when working with WEEK (Time) Dimension and I want them to be aggregated as AVERAGE when working with DEPARTMENT Dimension.

 

Hope if helps.

 

Thanks!!

Regards

@Greg_Deckler

@v-jiascu-msft

 

Sorry I forgot both mentions.

 

THANKS!!!

@ovinasca- What would be very helpful is if you could share the source data that results in the totals that you shared.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

 

 

OK, so what would that look like if it was aggregated by the "time dimension"?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

That's TOTAL(2) in the picture, and if you aggregate by department dimension you whould obtain TOTAL (1)

Hope it helps.... 

 

Maybe it's not possible....

 

Thanks!fte_ex2.jpg

Is there a reason why you cannot just have 2 measures, one for SUM and one for AVERAGE?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Well, I could try to use a work-around presentation for the data.

 

But anyway, using two different measures I will have the same problem working with matrix:

 

 

fte_ex3.jpg

 

 

The red cells are wrong.....

 

 

@ovinasca

 

Hi, try with this Measure in Values Section

 

Measure =
IF (
    HASONEVALUE ( Table1[TIME] );
    SUM ( Table1[FTE's] );
    AVERAGE ( Table1[FTE's] )
)

Regards

 

Victor

Lima - Peru

 

 

 




Lima - Peru
Anonymous
Not applicable

Solution is great and solves the initial problem. But can you help on the Total Sum cell as well? Current solution calculates the AVERAGE on the full table which returns 5 which doesn't make much sense. What is the solution to make the AVERAGE of total SUMs instead of AVERAGE of whole table at lowest level? The correct result should be 15

Thanks @Vvelarde I will try tomorrow, I think i will work for that specific example, but if I have other dimension?

 

fte_ex4.jpg

 

Not sure....

 

I will tell you !!!!

 

THANKS!

Hi @Vvelarde!! 

 

Works only for the suggested example, I mean, working only with two dimensions but works for me!

 

So thanks!!

 

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.