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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
as3znaus
Helper I
Helper I

Estimation from past month

Hi everyone!

 

Hope someone can help me with this. 

 

I have the following data in an excel spreadsheet.

 

 

CodeDirect costsStaff  costs BillingDateReport Date

 

P14.00010-4.0800oct.-16sep-16
P14.00010-5100nov.-16sep-16
P14.00010-5100dic.-16sept-16

 

As you can see, I have a Staff cost of 4.080 for October on my September Report (this number is an estimation).

 

 

The next month I will have the real cost for October, so I need a DAX function to compare these values.

 

1_Estimation M-1 for month M 

 

I need a formula to find the number that corresponds to date M (oct-16) and report date M-1 (sep-16), in this case 4.080.

 

2_Actual cost

 

I already got this meassure.

 

3_Difference between value

 

I already got this meassure.

 

 

 

Thanks a bunch!

 

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @as3znaus,

 

You can try to use belwo formula to get previous month's value:


Total cost of Previous Month=
var currCode= LASTNOBLANK(Table[Code],[Code])

Return
IF(Month(MAX[Date]))>1,

SUMX(FILTER(ALL(Table),[Code]= currCode && Month([Date])=Month(MAX([Date]))-1),[Staff  costs]),

SUMX(FILTER(ALL(Table),[Code]= currCode && Year([Date])=Year(MAX([Date]))-1&&Month([Date])=12),[Staff  costs]))

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft,

 

I have tried your formula but I can't make it work...these are my actual column names.

 

Code = Código

 

Table = DatosCostes

 

StaffCosts = CostePersonal

 

Date=Fecha

 

ReportDate= Fecha Report

 

I changed them and I get the following error:

 

http://jmp.sh/79eEjfB

 

 

 Thanks!

 

 

Hi @as3znaus,

 

It seems like you have miss the "=" charater.(my formula is a measure.)

Capture.PNG

 

In addition, you can try to use english character to name the variable.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft,

 

I finally solved it in a different way, I used a colum of "Current Date".

 

Thanks anyway!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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