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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
esuing
Helper I
Helper I

Problems using the ALL() function

I feel like this is a simple case, but I don't know what's happening. I have the following tables:

 

ColorTypes:

esuing_0-1666815907771.png

Types:

esuing_1-1666815940560.png

Data:

esuing_2-1666815969069.png

The joins should be pretty obvious (Data[Color] -> ColorTypes[Color], etc). And then I put together a very simple table that sums the Amt field by type and color:

esuing_3-1666816011159.png

I would like to add a measure that is the sum of the Amt for each type regardless of Color.  I use this function with this result:

Type Total = CALCULATE([Sum Amt],All(Data[Color]))
esuing_4-1666816227447.png

 

It should look something like this:

esuing_5-1666816369703.png

I'm not sure why it's introducing those new records as it doesn't seem to be adhering to the relationships between the three tables. Any help would be appreciated.

 

Thanks!

Eric

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @esuing,

It seems like the expression also expands the category groups which do not include records. Perhaps you can add an if statement to your expression to skip the calculation on these blank parts.

Type Total =
VAR result =
    CALCULATE ( [Sum Amt], ALL ( Data[Color] ) )
RETURN
    IF ( [Sum Amt] > 0, result )

Regards,

Xiaoxin Sheng

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

HI @esuing,

It seems like the expression also expands the category groups which do not include records. Perhaps you can add an if statement to your expression to skip the calculation on these blank parts.

Type Total =
VAR result =
    CALCULATE ( [Sum Amt], ALL ( Data[Color] ) )
RETURN
    IF ( [Sum Amt] > 0, result )

Regards,

Xiaoxin Sheng

Thank you! This is what I was looking for any worked in my other application with a much larger dataset really well!

Mikelytics
Resident Rockstar
Resident Rockstar

Hi Eric,

 

Please try: 

Type Total = CALCULATE([Sum Amt],All(ColorTypes[Color])) and when you put the columns in the visual please use the color column from the ColorTypes table

 

Best regards

Michael

 

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

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
aj1973
Community Champion
Community Champion

Hi @esuing 

Go to filter Panel 

aj1973_0-1666819052762.png

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Hi. Thanks.. this does work, however, I was hoping there was something in the measure itself that would prevent me from having to do this as it seems it would run more efficiently if it didn't return a value for every value in both tables..  The dataset I'm using for work is HUGE (versus this example I just presented in this thread) and so it's very slow doing it this way.

aj1973
Community Champion
Community Champion

Use the same columns from the Table ColorTypes into your visual and modify the measure:

aj1973_0-1666820431076.png

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors