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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply

Measure in calculating the Grand Total on Each Row on a Specific Months.

Hello,

Is the column C possible to replicate on a Measure? The 85 is the total sum of 3 months (april, may, june). I just wanted to get the total value of a specific months. 

EvanGetsItDone_0-1686328206372.png

Just comment out if you need more details. 
Thanks! 

2 ACCEPTED SOLUTIONS

Hi @EvanGetsItDone 
Then modify it into 2 steps:

1. As you don't have a date column and your months are text, add a month number column:

MonthN = SWITCH('Table'[Month],"jan",1,
"feb",2,
"mar",3,
"apr",4,
"may",5,
"jun",6,
"jul",7,
"Aug",8,
"Sep",9,
"oct",10,
"Nov",11,
"Dec",12,
0)
Ritaf1983_0-1686447146831.png

2. Modify First Dax based on this column :

C = CALCULATE(SUM('Table'[B]),
FILTER('Table','Table'[MonthN]=month(today()) || 'Table'[MonthN]=month(today())-1 || 'Table'[MonthN]=month(today())-2))
Ritaf1983_1-1686447235889.png

Link to a sample file 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table.  Create calculated column formulas for Year, Month name and Month number.  Sort the Month name by the Month number.  To your visual, drag Year and Month name from the Calendar Table.  Write this measure

Measure = calculate([sales],datesbetween(calendar[date],edate(eomonth(today(),-1)+1,-2),eomonth(today(),0)))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table.  Create calculated column formulas for Year, Month name and Month number.  Sort the Month name by the Month number.  To your visual, drag Year and Month name from the Calendar Table.  Write this measure

Measure = calculate([sales],datesbetween(calendar[date],edate(eomonth(today(),-1)+1,-2),eomonth(today(),0)))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ritaf1983
Super User
Super User

Hi @EvanGetsItDone 
You can add a calculated column with a formula :

 
C = CALCULATE(SUM('Table'[B]),
FILTER('Table','Table'[Month]="Apr" || 'Table'[Month]="May" || 'Table'[Month]="Jun"))
Ritaf1983_0-1686398947652.png

 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hello,
Thanks for the response! 
Sorry I may not have mentioned it. But I actually need the 3 months (including current month). It doesn't have to be a constant april, may, and june. I need a measure that would calculate the current month and the last 2 months. 

Thanks!

Hi @EvanGetsItDone 
Then modify it into 2 steps:

1. As you don't have a date column and your months are text, add a month number column:

MonthN = SWITCH('Table'[Month],"jan",1,
"feb",2,
"mar",3,
"apr",4,
"may",5,
"jun",6,
"jul",7,
"Aug",8,
"Sep",9,
"oct",10,
"Nov",11,
"Dec",12,
0)
Ritaf1983_0-1686447146831.png

2. Modify First Dax based on this column :

C = CALCULATE(SUM('Table'[B]),
FILTER('Table','Table'[MonthN]=month(today()) || 'Table'[MonthN]=month(today())-1 || 'Table'[MonthN]=month(today())-2))
Ritaf1983_1-1686447235889.png

Link to a sample file 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.