cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
rhall_hillintl
Regular Visitor

SUM Based on Model Sold for MTD, YTD, LMTD, LYTD

I am attempting to create what was pretty simple to do in a Pivot Table in Power BI.

 

I need to SUM the GP$ for each model sold based on MTD, YTD etc.. I am currently just trying to get MTD to work then I could be fine. I also need to count the models sold for each interval.

 

The problem is, when the GP$ is 0 for the timeframe it is putting in a number that is not in the date range specified by 'TOTALMTD' which I would assume would only show me the JUNE numbers. What is weird to me is the total at the bottom of the table is showing correctly.. My MTD measure :

 

MTD = TOTALMTD(SUM(RAW[GP$]),RAW[Contract Date])

I also created a DATE table and linked it to my 'RAW' table with the same results:

 

MTD = TOTALMTD(SUM(RAW[GP$]),DimDate[Date])

Here are my results in Power BI which are incorrect for the MTD, and here is a sample from a Pivot Table inside of Excel which is correct:

Capture.JPGCapture.JPG

1 ACCEPTED SOLUTION

I got this fixed. It seems I needed to filter the dates even when using TOTALMTD, so I instead am just using CALCULATE.

 

MTD GP$ = CALCULATE(
        SUM(RAW[GP$]),
        FILTER(DimDate, DimDate[MonthofYear] = MONTH(NOW())))
Last MTD GP$ = CALCULATE(
        SUM(RAW[GP$]),
        FILTER(DimDate, DimDate[MonthofYear] = MONTH(NOW()) - 1))

View solution in original post

4 REPLIES 4
trajs
New Member

This solution is not working with Other KPIs. I want to see the Category wise MTD & LMTD. Pls suggest..

Ashish_Mathur
Super User
Super User

Hi,

 

Share the link from where i can download your PBI file.


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

I got this fixed. It seems I needed to filter the dates even when using TOTALMTD, so I instead am just using CALCULATE.

 

MTD GP$ = CALCULATE(
        SUM(RAW[GP$]),
        FILTER(DimDate, DimDate[MonthofYear] = MONTH(NOW())))
Last MTD GP$ = CALCULATE(
        SUM(RAW[GP$]),
        FILTER(DimDate, DimDate[MonthofYear] = MONTH(NOW()) - 1))

Thanks for the reply Ashish.

 

Sales.pibx

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors