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
anandav
Skilled Sharer
Skilled Sharer

How to calculate monthly totals?

Hi All,

 

I have the following data

Country   Product        Sales     Qty        Sales Date 

AProduct 1100102/01/2018
BProduct 2200202/01/2018
CProduct 3300303/01/2018
DProduct 1400405/01/2018
EProduct 2500507/02/2018
AProduct 16006010/02/2018
BProduct 27007011/02/2018
CProduct 28008012/03/2018
DProduct 28509014/03/2018
DProduct 3100010015/03/2018

 

I want to calucate the total for each month.

Country          Product                 Sales                     Qty               Sales Date       Month Sales

AProduct 1100102/01/2018 
BProduct 2200202/01/2018 
CProduct 3300303/01/2018 
DProduct 1400405/01/20181000
EProduct 2500507/02/2018 
AProduct 16006010/02/2018 
BProduct 27007011/02/20181800
CProduct 28008012/03/2018 
DProduct 28509014/03/2018 
DProduct 3100010015/03/20182650

 

Any help would be appreciated.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Right click on Calendar Date, new hierarchy, I suppose this will solve your problem.

 

Then you should have year, quarter, month and day available.

View solution in original post

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @anandav,

 

As  @Anonymous mentioned, you could create a table with Date hierarchy like below then you could get Month total sales.

 

Capture.PNG

 

In addition, you could create a calculated column with the formula below.

 

Sales per month =
CALCULATE (
    SUM ( Sales[Sales] ),
    FILTER (
        'Sales',
        MONTH ( 'Sales'[Sales Date] ) = MONTH ( EARLIER ( 'Sales'[Sales Date] ) )
    )
)

Then you could get your expected output.

 

Month total.PNG

 

For reference, you could have a look at this similar thread.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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

7 REPLIES 7
Anonymous
Not applicable

Hi. I have a similar situation and I want the result as the other user.  I tried the bellow options but none worked.

 

I want to calculate Each Employees Monthly Working Hours - therefore by employe and month-year.

I am using below formula: 

 

Total Hourse per month = CALCULATE(sum(working hours]);FILTER('workers table'; 'workers table'[Date].[Date] && FILTER('workers table'; 'workers table'[name and surname]))) 
 
getting below error 
 
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
 
Can anyone help? 
Thanks a lot!!
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @anandav,

 

As  @Anonymous mentioned, you could create a table with Date hierarchy like below then you could get Month total sales.

 

Capture.PNG

 

In addition, you could create a calculated column with the formula below.

 

Sales per month =
CALCULATE (
    SUM ( Sales[Sales] ),
    FILTER (
        'Sales',
        MONTH ( 'Sales'[Sales Date] ) = MONTH ( EARLIER ( 'Sales'[Sales Date] ) )
    )
)

Then you could get your expected output.

 

Month total.PNG

 

For reference, you could have a look at this similar thread.

 

Best Regards,

Cherry

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

@v-piga-msft

 

Hi!

 

Could you just explain what the EARLIER does here? I'm a bit confused by that function TBH.

 

Thanks!

Hi @Anonymous,

Check this article. It may help you and also explain how you can use variables to avoid using EARLIER.

https://www.sqlbi.com/articles/variables-in-dax/

 

Anonymous
Not applicable

Do you have a Calendar Table? On the field list, do you see any "Date Hierarchy"?

@Anonymous,

Yes, I have a calendar table and relationsip established with Sales Date in Sales table.

No, I cannot see the date hierarchy.

 

Anonymous
Not applicable

Right click on Calendar Date, new hierarchy, I suppose this will solve your problem.

 

Then you should have year, quarter, month and day available.

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