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
Hi everyone!
I am struggling with a difficult problem. I have a fact table with 2 dates: Task Start Date and Task End Date. I have another dimension table (calendar table) with 2 inactive relationships between these 2 dates and calendar date. In calendar table I have information about Year and month.
How to calculate it in dax? I have tried with something using selectedvalue(calendar[year]), selectedvalue(calendar[month]) and combine it with these 2 dates, but it is incorrect. 1 should be inserted if calendar Year and calendar Month match to Year and Month these 2 dates.
Solved! Go to Solution.
Hi @Anonymous
please use
=
VAR MaxDate =
MAX ( 'Calendar'[Date] )
VAR MinDate =
MIN ( 'Calendar'[Date] )
RETURN
SUMX (
TableName,
IF ( TableName[StartDate] <= MaxDate && TableName[EndDate] >= MinDate, 1 )
)
Hi @Anonymous
please use
=
VAR MaxDate =
MAX ( 'Calendar'[Date] )
VAR MinDate =
MIN ( 'Calendar'[Date] )
RETURN
SUMX (
TableName,
IF ( TableName[StartDate] <= MaxDate && TableName[EndDate] >= MinDate, 1 )
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 13 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 29 | |
| 24 | |
| 17 | |
| 11 | |
| 10 |