Forum Discussion
Relationship issue when Calendar table filtering two date columns in fact table
- Oct 14, 2023
1) Created_On field in Communications is actually datetime.
Applying date format won't change datetime value, thus relationship with Date in calendar doesn't work, in the latest dates are with zero time.
You may create another column in Communications as
Create_On_Date = INT(Communications[Created_On])
, apply date format if you wish (not necessary) and create relationship with calendar based on this field.
2) You don't need another relationship on Closed_On, above is enough
3) Not necessary but desirable to mark calendar as Date table (from 3-dots menu) with Date as a Key field; and uncheck Time Intelligence in options
Without that when you use time intelligence function PBI builds in background hidden date tables which overload the model and actually not under your control. It's enough to use Calendar table for that (marked as date table) taking into account it covers all periods.
Please note, if you've created measure with time intelligence most probably you need to re-create them with shifting on calendar as date table.
4) Measures could be
Queries Open = CALCULATE ( COUNTROWS ( Communications ), Communications[Closed_On] = BLANK () ) Queries Closed = CALCULATE ( COUNTROWS ( 'Communications' ), Communications[Closed_On] <> BLANK () )
5) With that visual looks as
1) Created_On field in Communications is actually datetime.
Applying date format won't change datetime value, thus relationship with Date in calendar doesn't work, in the latest dates are with zero time.
You may create another column in Communications as
Create_On_Date = INT(Communications[Created_On])
, apply date format if you wish (not necessary) and create relationship with calendar based on this field.
2) You don't need another relationship on Closed_On, above is enough
3) Not necessary but desirable to mark calendar as Date table (from 3-dots menu) with Date as a Key field; and uncheck Time Intelligence in options
Without that when you use time intelligence function PBI builds in background hidden date tables which overload the model and actually not under your control. It's enough to use Calendar table for that (marked as date table) taking into account it covers all periods.
Please note, if you've created measure with time intelligence most probably you need to re-create them with shifting on calendar as date table.
4) Measures could be
Queries Open = CALCULATE (
COUNTROWS ( Communications ),
Communications[Closed_On] = BLANK ()
)
Queries Closed = CALCULATE (
COUNTROWS ( 'Communications' ),
Communications[Closed_On] <> BLANK ()
)
5) With that visual looks as
Dear Sir,
Thank you so much for your help with this beautiful solution!
Wow! this is best solution I would have asked for and many thanks!
I apologize for the delayed response and I appreciate your patience!
The reason for delay is I wanted to test the report fully so that it did not cause any issues later on.
Your guidance has really helped me resolve the doubts.
I found your explanation on creating 'INT(Communication[created_on]' very insightful.
If there's anything I can assist you with in the future, please don't hesitate to ask.
Thanks again for your support, it means a lot to me.