The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Solved! Go to Solution.
Thank you for your help, I was able to finally figure out the solution:
Thank you for your help, I was able to finally figure out the solution:
@loos
I thought your YearMonth column is an integer data type. Just now I realized it is a Date data type. This is the importance of posting some sample data along with the expected results.
Hi @loos
Allways better to have a date table. However, if you wish not not to use one please try
Previous Month FTE =
VAR CurrentYearMonth =
MAX ( HRdata[YearMonth] )
VAR PreviousYearMonth =
TOPN (
1,
FILTER ( ALL ( HRdata[YearMonth] ), HRdata[YearMonth] < CurrentYearMonth ),
HRdata[YearMonth]
)
RETURN
CALCULATE (
SUM ( HRdata[FTE] ),
FILTER ( ALL ( HRdata ), HRdata[YearMonth] = PreviousYearMonth )
)
I should have mentioned one more thing, there are other filters (slicers) that also exist. So if I have no filters selected other than the date slicer, your formula works. But if I use the other slicers to select the type of company, etc, the Previous Month number stays the same and does not drill down alongside the Current Month. Is there anyway to allow the other filters to affect this number?
@loos
You may also try
Previous Month FTE =
VAR CurrentYearMonth =
MAX ( HRdata[YearMonth] )
VAR PreviousYearMonth =
TOPN (
1,
FILTER ( ALL ( HRdata[YearMonth] ), HRdata[YearMonth] < CurrentYearMonth ),
HRdata[YearMonth]
)
RETURN
CALCULATE (
SUM ( HRdata[FTE] ),
HRdata[YearMonth] = PreviousYearMonth,
ALLEXCEPT ( HRdata, HRdata[FilterSafeColumn1], HRdata[FilterSafeColumn2], ....etc )
)
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |