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
JulioCastillo
Helper I
Helper I

Calculate Branch Cost

Hello
 
I'm trying to sum up the values for different Dimension within the the GL Entry table.
As I'm new to Power BI i think i don't use the correct Filter function or there is a smoother way to get
to the result. All support is highly appreciated.
 
Total Branch Costs =
CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),
FILTER('AX$G_L Entry (2)', 'AX$G_L Entry (2)'[Global Dimension 1 Code] = "SA"))
FILTER('AX$G_L Entry (2)', 'AX$G_L Entry (2)'[Global Dimension 1 Code] = "BM"))
FILTER('AX$G_L Entry (2)', 'AX$G_L Entry (2)'[Global Dimension 1 Code] = "CS"))
1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @JulioCastillo ,

 

Since I don't know what exactly the expected results you want. I list several cases.

Sample data.

vstephenmsft_2-1664173653753.png

 

 

1.Remove the concept of grouping and return the total for each row.

Measure = CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),ALLSELECTED('AX$G_L Entry (2)'))

vstephenmsft_3-1664173705768.png

 

2.Summing by grouping [Global Dimension 1 Code], ignoring the context of the year.

Measure 2 = CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),FILTER(ALLSELECTED('AX$G_L Entry (2)'),[Global Dimension 1 Code]=MAX('AX$G_L Entry (2)'[Global Dimension 1 Code])))

 

vstephenmsft_4-1664174069889.png

 

3.If you only want to ask for the sum of part [Global Dimension 1 Code], you can write it like this

Measure 3 = CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),FILTER(ALLSELECTED('AX$G_L Entry (2)'),[Global Dimension 1 Code]="BM"||[Global Dimension 1 Code]="CS"))

Summing which [Global Dimension 1 Code] is "BM" or "CS".

vstephenmsft_5-1664174184852.png

 

If the above cases is still not what you want, please provide some sample data and the desired result.

 

Best Regards,

Stephen Tao

 

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

View solution in original post

6 REPLIES 6
v-stephen-msft
Community Support
Community Support

Hi @JulioCastillo ,

 

Since I don't know what exactly the expected results you want. I list several cases.

Sample data.

vstephenmsft_2-1664173653753.png

 

 

1.Remove the concept of grouping and return the total for each row.

Measure = CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),ALLSELECTED('AX$G_L Entry (2)'))

vstephenmsft_3-1664173705768.png

 

2.Summing by grouping [Global Dimension 1 Code], ignoring the context of the year.

Measure 2 = CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),FILTER(ALLSELECTED('AX$G_L Entry (2)'),[Global Dimension 1 Code]=MAX('AX$G_L Entry (2)'[Global Dimension 1 Code])))

 

vstephenmsft_4-1664174069889.png

 

3.If you only want to ask for the sum of part [Global Dimension 1 Code], you can write it like this

Measure 3 = CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),FILTER(ALLSELECTED('AX$G_L Entry (2)'),[Global Dimension 1 Code]="BM"||[Global Dimension 1 Code]="CS"))

Summing which [Global Dimension 1 Code] is "BM" or "CS".

vstephenmsft_5-1664174184852.png

 

If the above cases is still not what you want, please provide some sample data and the desired result.

 

Best Regards,

Stephen Tao

 

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

@v-stephen-msftThank you so much for the detailed response.

VijayP
Super User
Super User

@JulioCastillo  I just forgot remove the other filters, use this code

CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),
FILTER('AX$G_L Entry (2)'
'AX$G_L Entry (2)'[Global Dimension 1 Code] = "SA")&&
 'AX$G_L Entry (2)'[Global Dimension 1 Code] = "BM")&&
'AX$G_L Entry (2)'[Global Dimension 1 Code] = "CS"))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


 now I get the following error message:
Operator or expression '()' is not supported in this context.
 
Total Branch Costs =
CALCULATE(SUM('AX AG$G_L Entry (2)'[Amount]),
FILTER('AX AG$G_L Entry (2)', 'AX AG$G_L Entry (2)'[Global Dimension 1 Code] = "SA")&&
('AX AG$G_L Entry (2)', 'AX AG$G_L Entry (2)'[Global Dimension 1 Code] = "BM")&&
('AX AG$G_L Entry (2)', 'AX AG$G_L Entry (2)'[Global Dimension 1 Code] = "CS")
@VijayP
VijayP
Super User
Super User

@JulioCastillo  try the below one!

Total Branch Costs =
CALCULATE(SUM('AX$G_L Entry (2)'[Amount]),
FILTER('AX$G_L Entry (2)''AX$G_L Entry (2)'[Global Dimension 1 Code] = "SA")&&
FILTER('AX$G_L Entry (2)''AX$G_L Entry (2)'[Global Dimension 1 Code] = "BM")&&
FILTER('AX$G_L Entry (2)''AX$G_L Entry (2)'[Global Dimension 1 Code] = "CS"))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Hi,

Thanks for your input unfortunately I get the following error message:

Filter been used in a True/False expression that is used as a table filter expression. This is not allowed.

 

Any hint on how to change the formula?

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