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

View all the Fabric Data Days sessions on demand. View schedule

Reply
meetgandhi100
Frequent Visitor

Measure to calculate SUM of Values based on Grouping of columns from two Tables

Hello I am new to Power BI and would appreciate help regarding the following:

 

Given:

Year  Month  Day  Sales

2010     1         1    300

2010     1         2    100

2010     2         1    300

2010     2         2    200

 

 

Expected

Year   Month  Day   Summation of Sales By Month

2010     1         1             400

2010     1         2             400

2010     2         1             500

2010     2         2             500

 

Constraints:

I am using DirectQuery

In this example the sorting I require Summation by Month

What I actually require is Summation by Month and Age

 

 

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @meetgandhi100 ,

 

Capture.PNG



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

Proud to be a Super User!



View solution in original post

10 REPLIES 10
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Summation of Sales By Month = 
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Month] IN FILTERS ( 'Table'[Month] ) )
)

The result shows:

15.PNG

 

Best Regards,

Giotto

Mariusz
Community Champion
Community Champion

Hi @meetgandhi100 

 

Try this

Measure = 
CALCULATE(
    [Sales],
    ALL( 'Calendar'[Day] )
)
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn




camargos88
Community Champion
Community Champion

Hi @meetgandhi100 ,

 

Capture.PNG



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

Proud to be a Super User!



Thanks @camargos88  . What If I want to Group based on two columns from two different tables?

 

Hi @meetgandhi100 ,

 

It depends on how they are related. But it's possible.



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

Proud to be a Super User!



Great, can you help me with the exact situation.

 

Dimension 1 Table                  DImension 2 Table                          Fact table

Year   Month   Key1                Category    Catkey                          Key1  Catkey  Sum

2010    Jan           1                        A               1                                 1       1         100

2011    Feb          2                         A               2                                1       2          100

                                                      B               3                                 1       3          100

 

Required Output

 

Year  Category   Sum

2010    A             200

 

Can you let me know how to create a measure to acheive this using with DirectQuery @camargos88 @v-gizhi-msft @Mariusz 

Hi,

 

Please try this measure:

Sum = CALCULATE(SUM('Fact Table'[Sum]),FILTER('Fact Table',RELATED('Dimension 2 Table'[Category])="A"))

The result shows:

3.PNG

See my attached pbix file.

 

Best Regards,

Giotto

Hi @meetgandhi100 ,

 

I believe if you have them related, you just need to drag the year / category and sum columns to the tables visual. Also filter the category using a slicer.

 

Capture.PNG



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

Proud to be a Super User!



I just want them to be shown in a report , wihout any slicers. 

@meetgandhi100 ,

 

You can use the filter pane.

https://docs.microsoft.com/en-us/power-bi/create-reports/power-bi-report-filter

 

Just click on the visual and select the filters.

Also you can apply for the page or report.



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

Proud to be a Super User!



Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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