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.
Hi everyone!
Hope someone can help me with this.
I have the following data in an excel spreadsheet.
Code | Direct costs | Staff costs | Billing | Date | Report Date |
P14.0001 | 0 | -4.080 | 0 | oct.-16 | sep-16 |
P14.0001 | 0 | -510 | 0 | nov.-16 | sep-16 |
P14.0001 | 0 | -510 | 0 | dic.-16 | sept-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!
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
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:
Thanks!
Hi @as3znaus,
It seems like you have miss the "=" charater.(my formula is a measure.)
In addition, you can try to use english character to name the variable.
Regards,
Xiaoxin Sheng
Hi @v-shex-msft,
I finally solved it in a different way, I used a colum of "Current Date".
Thanks anyway!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |