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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Wisselaar
Helper I
Helper I

Use Calender table in Month On Month (MOM) calculation not working

I need to calculate a month on month (MOM) of a measure, Error Percentage. This works only if I use the data from the Error-table itself, but I'd like to use the related Calender table. If not, filtering on a reportpage doesn't work.

 

The error-table and the calendertable are linked using a data as an integer. 

 

Any help would be great.

 

So this works:

 

Error % MOM % = 

VAR Prev =
    CALCULATE(AVERAGE(ErrorTotalsMonth[Error % (EOM)]); DATEADD(ErrorTotalsMonth[Date End Of Month]; -1; MONTH))

VAR Cur =
    CALCULATE(AVERAGE(ErrorTotalsMonth[Error % (EOM)]))

VAR Result =
    DIVIDE((Cur-Prev); Prev; 0)

RETURN IF(NOT(Cur = BLANK()); Result; BLANK())

 

Wisselaar_0-1606211016626.png

 

But this doesn't:

 

Error % MOM % = 

VAR Prev =
    CALCULATE(AVERAGE(ErrorTotalsMonth[Error % (EOM)]); DATEADD(_CalenderTable[Date]; -1; MONTH))

VAR Cur =
    CALCULATE(AVERAGE(ErrorTotalsMonth[Error % (EOM)]))

VAR Result =
    DIVIDE((Cur-Prev); Prev; 0)

RETURN IF(NOT(Cur = BLANK()); Result; BLANK())

 

 

Wisselaar_2-1606211209303.png

 

 

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Wisselaar ,

 

Is there a relationship between your calendar table and error-table?

 

After you create a relationship, you can filter the dates in the calendar table.

 

For more information, you can kindly refer to:

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-create-and-manage-relationships

 

 

 

Best Regards,

Stephen Tao

 

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

amitchandak
Super User
Super User

@Wisselaar , are you taking Date end of month column from _calendatTable, If not use from there.

 

Also, try a formula like the one given below as in the example

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
this month =MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value =  CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))

 

 

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.