Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi all,
I have a table with multiple columns. One is Resource Name, one is Date, one is Absences. What I need to do is for each Month (i.e. a record under the Date column) if that Date is in future I calculate vacations, if not I use the number under Absences column. I created the a column and named it Vacations which is using the following DAX:
Solved! Go to Solution.
Hi @Anonymous , try this:
1.- Inser a Index Column in Power Query (in my example the name of column is Índex2
2.- Create a calculate column with this formule:
Vacations = VAR CurrentDate =DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 01 )
VAR Condi=if(ResPlan[Date]=LOOKUPVALUE(ResPlan[Date],ResPlan[Índex2],ResPlan[Índex2]-1),1,0)
RETURN
IF ( ResPlan[Date] < CurrentDate, ResPlan[Absences],
IF (Condi=0,
IF (MONTH ( ResPlan[Date] ) = 7 || MONTH ( ResPlan[Date] ) = 8, 5 * 7,
IF ( MONTH ( ResPlan[Date] ) = 12, 4 * 7, 3*7)),
BLANK())
)
The result:
Best regards
Hi @Anonymous , try this:
1.- Inser a Index Column in Power Query (in my example the name of column is Índex2
2.- Create a calculate column with this formule:
Vacations = VAR CurrentDate =DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 01 )
VAR Condi=if(ResPlan[Date]=LOOKUPVALUE(ResPlan[Date],ResPlan[Índex2],ResPlan[Índex2]-1),1,0)
RETURN
IF ( ResPlan[Date] < CurrentDate, ResPlan[Absences],
IF (Condi=0,
IF (MONTH ( ResPlan[Date] ) = 7 || MONTH ( ResPlan[Date] ) = 8, 5 * 7,
IF ( MONTH ( ResPlan[Date] ) = 12, 4 * 7, 3*7)),
BLANK())
)
The result:
Best regards
Thanks for your help. I tried your formula but still the same result for November and December (please see below):
There was an issue with my Index. I had to sort by Name and Date first, then create the Index. it works now.
Thanks again
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 42 | |
| 37 | |
| 34 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 65 | |
| 62 | |
| 31 | |
| 26 | |
| 25 |