Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I thought I had solved this problem but it turns out that the data is wrong.
I have two tables
One has the amount of absence that each employee has ("Absence")
| Name | ID | Date |
| Rachel | 1 | 10/1/2023 |
| Rachel | 1 | 10/2/2023 |
| Rose | 2 | 10/2/2023 |
| Rose | 2 | 10/3/2023 |
| Matt | 3 | 10/3/2023 |
| Damon | 5 | 10/5/2023 |
The othe table ("Medical certificates") has the duration of the medical certificates received in office
| ID | Name | Begin | End |
| 1 | Rachel | 10/1/2023 | 10/2/2023 |
| 3 | Matt | 10/3/2023 | 10/3/2023 |
I want to create a calculated column that relates the ID and the date so when I create it it looks something like this
| Name | ID | Date | |
| Rachel | 1 | 10/1/2023 | Certificate |
| Rachel | 1 | 10/2/2023 | Certificate |
| Rose | 2 | 10/2/2023 | |
| Rose | 2 | 10/3/2023 | |
| Matt | 3 | 10/3/2023 | Certificate |
| Damon | 5 | 10/5/2023 |
The code that I previously had was this one:
Solved! Go to Solution.
Something like the following might work for you as a calculated column in your abscence table.
Medical_Cert =
var _id =
[ID]
var _date =
[Date]
var _value =
COUNTROWS(
FILTER(certificateTable, certificateTable[ID] = _id && certificateTable[Begin] <= _date && certificateTable[End] >= _date)
)
RETURN
IF(
_value = 1,
"Certificate",
""
)
Proud to be a Super User! | |
That works excellently but for some reason I had to substract a day in
certificateTable[Begin]for it to be correct
Medical_Cert =
var _id =
[ID]
var _date =
[Date]
var _value =
COUNTROWS(
FILTER(certificateTable, certificateTable[ID] = _id && certificateTable[Begin]-1 <= _date && certificateTable[End] >= _date)
)
RETURN
IF(
_value = 1,
"Certificate",
""
)
Thank you very much!
Something like the following might work for you as a calculated column in your abscence table.
Medical_Cert =
var _id =
[ID]
var _date =
[Date]
var _value =
COUNTROWS(
FILTER(certificateTable, certificateTable[ID] = _id && certificateTable[Begin] <= _date && certificateTable[End] >= _date)
)
RETURN
IF(
_value = 1,
"Certificate",
""
)
Proud to be a Super User! | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 36 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 74 | |
| 66 | |
| 65 |