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

How to aggregate a Measure

Hey all,

 

I try to calculate the SUM of a calculated measure aggregated by stores.

 

For Example:
Stoe          Measure1

A               100

B               150

C               120

 

Now I want to create a measure which gets 370 as a result. 

I tryed the following way:

test =
VAR tab1 = SUMMARIZECOLUMNS(Store[StoreId], "Measure1", [Measure1])
return
SUMX(tab1, [Measure1])
...but when I'm using the created measure in a visual within PowerBI, the following Error occurs: "summarizecolumns() and addmissingitems() may not be used in this context"

 

Maybe some of you have an Idea.

 

Thank you very much!

_MG_

 

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @_MG_ 

Create another measure based on the one you have:

M2 =
SUMX ( DISTINCT ( Table1[Store]), [Measure1] )

 You can use it on a table visual with Table1[Store] on the rows and you'll get the result for each store plus the sum at the total line. Or you can just use M2 in card visual to get only the total

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

Hi @_MG_ 

Create another measure based on the one you have:

M2 =
SUMX ( DISTINCT ( Table1[Store]), [Measure1] )

 You can use it on a table visual with Table1[Store] on the rows and you'll get the result for each store plus the sum at the total line. Or you can just use M2 in card visual to get only the total

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

_MG_
Frequent Visitor

Too easy...
Thank you very much! 

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.

Top Solution Authors