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

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

Reply
troyhimes
Resolver I
Resolver I

Yet another MTD question!

Yet Another MTD Question! (udpated) Dropbox File

 

With the forum's help I was able to solve a couple of related questions, but this one has me stumped.  The MTD values (BTZ Feed Ozs MTD) do not equal the cumulative daily values (BTZ Feed Ozs).  See sheet below: Grand Total MTD = 3714 & cumulative daily = 3870.

 

BTZ Feed Ozs = Btz Tons * BTZ 30day avg (trailing 30 day avg)

 

Current Result:   

     BTZ Feed Ozs MTD = Btz Tons (MTD) * BTZ 30day avg (daily)

 

Desired Result

     BTZ Feed Ozs MTD = sum of each day's BTZ Feed Ozs 

 

2020-03-20_12-25-00.png

 

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

Might be wrong, bu this looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for the links Greg, I wasn't aware of the HASONExxxxx functions.

 

I may not be seeing it, but I don't think it's the solution to this issue though.  The Grand Total value is not used for anything, I'm just displaying it for illustration purposes in this post.  My issue is with the MTD calculation.....I don't know if I'm using the correct terminology but how do I keep the row to row context when adding the daily values for the MTD calc?

 

As expected, the 3/1 daily BTZ Feed Ozs calc uses the row context (3/1 Btz Tons * 3/1 BTZ 30day avg) as does the MTD.

         3/1 Daily=312    &    MTD=312

 

On subsequent days (example 3/2), again as expected the 3/2 daily BTZ Feed Ozs calc uses the row context (3/2 Btz Tons * BTZ 30day avg) BUTthe MTD calc uses (Cumulative Feed Ozs * Current Row daily 30day avg ----> 3/1 + 3/2 BTZ Feed Ozs * 3/2 BTZ 30day avg)

         3/2 Daily=271    &     MTD=591

 

The daily values return 312+271=583 but my MTD value is returning 591 based on the calc above.

 

 

Anonymous
Not applicable

// Calendar must be the Date table in the model
// marked as such.

[BTZ Feed Ozs MTD] =
	sumx(
		DATESMTD( Calendar[Date] ),
		[Btz Tons] * [Btz 30day avg]
	)

 

Best

D

@Anonymous , based on your response, my "row context" was probably incorrectly used and I am using the Date Table.

 

The BTZ 30day avg is a measure and here's the formulas...

 

BTZ Feed Ozs:=sum(Conccentrator_Final[Blitz Tons])*[BTZ 30day avg]

 

BTZ Feed Ozs MTD:=CALCULATE (
          [BTZ Feed Ozs],
          DATESMTD( 'Calendar'[Date] ),
          Conccentrator_Final[Feed Oz's_2] > 0
)

Anybody have any other suggestions?  For more clarification, here's the measures I'm using.

 

BTZ Feed Ozs MTD:=CALCULATE (
[BTZ Feed Ozs],
DATESMTD( 'Calendar'[Date] ),
Conccentrator_Final[Feed Oz's_2] > 0
)

BTZ Feed Ozs :=
SUM ( Conccentrator_Final[Blitz Tons] ) * [BTZ 30day avg]

BTZ 30day avg :=
CALCULATE (
AVERAGE ( 'Data input'[PtPd] ),
'Data input'[Region] = "BLITZ",
DATESINPERIOD (
'Calendar'[Date],
LASTDATE ( 'Calendar'[Date] ),
- [Days in Avg Calc],
DAY
)
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.