Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
gustavog80
Regular Visitor

Calculation groups to switch between dates not working as expected

Hi all,

I'm trying to dynamize a report to give user the hability of switching between different dates to filters some data. I read some ideas and seems that the best option is set 3 relationships to calendar Table ( one for every field date I wanted to allow filter), one active, two inactives, and enable / disable any of them using USING RELATIONSIPS in my measures, so I can get the numbers filtered by any of these dates.

I created 3 calculations group items like this:

 

Tenant Lease Date = 
                CALCULATE(
                        SELECTEDMEASURE(),
                        USERELATIONSHIP(sample_dataset[Tenant Lease Executed],
                                        'Calendar'[Date]
                                        )               
                        )  

 

 

In the upper table, u can see the correct numbers without using slicers and calculations groups.

gustavog80_0-1741035012155.png

If u choose in the slicer Tenant Lease, and filter one year, for example 2025, number change ( in both tables, upper and down) so think something is wrong with my approach:

gustavog80_1-1741035117111.png

 


So I expected, when chossing the desired date field, get the same values than filtering the date manually (without using the dynamic slicer), but numbers do change. Am I doing st wrong ? Cant find there is the issue



I uploaded here the dashboard:

https://drive.google.com/file/d/104mHmO8CG-3kU1MhU3L8GI--8bfeH0M3/view?usp=sharing

Thanks in advance,
Regards

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @gustavog80 

The issue appears to be that the columns sample_dataset[Tenant Lease Executed] and sample_dataset[Forecast Month] each contain values with non-zero time components, so they are not pure "dates".

This is causing inconsistent results since the relationship with 'Calendar' relies on having date values with no time component in order to filter correctly.

 

I would recommend changing the types of both columns to date in either the source file or Power Query.

 

While those columns have been changed to Data type = Date in the Power BI model interface, this does not remove the time component of the values, but merely hides it. Date and DateTime are really the same underlying type when loaded to the model. To be certain of "dates" being loaded, the type must be changed upstream, in Power Query or source.

 

You can verify that this is the issue by running a query like this in the DAX Query view:

 

EVALUATE
	SELECTCOLUMNS(
		SUMMARIZE(
			sample_dataset,
			sample_dataset[Tenant Lease Executed],
			sample_dataset[Forecast Month]
		),
		"Tenant Lease Executed Formatted", FORMAT(
			sample_dataset[Tenant Lease Executed],
			"yyyy-MM-dd HH:mm:ss"
		),
		"Forecast Month Formatted", FORMAT(
			sample_dataset[Forecast Month],
			"yyyy-MM-dd HH:mm:ss"
		)
	)
	ORDER BY
		[Tenant Lease Executed Formatted],
		[Forecast Month Formatted]

 

OwenAuger_0-1741048135387.png

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @gustavog80 

The issue appears to be that the columns sample_dataset[Tenant Lease Executed] and sample_dataset[Forecast Month] each contain values with non-zero time components, so they are not pure "dates".

This is causing inconsistent results since the relationship with 'Calendar' relies on having date values with no time component in order to filter correctly.

 

I would recommend changing the types of both columns to date in either the source file or Power Query.

 

While those columns have been changed to Data type = Date in the Power BI model interface, this does not remove the time component of the values, but merely hides it. Date and DateTime are really the same underlying type when loaded to the model. To be certain of "dates" being loaded, the type must be changed upstream, in Power Query or source.

 

You can verify that this is the issue by running a query like this in the DAX Query view:

 

EVALUATE
	SELECTCOLUMNS(
		SUMMARIZE(
			sample_dataset,
			sample_dataset[Tenant Lease Executed],
			sample_dataset[Forecast Month]
		),
		"Tenant Lease Executed Formatted", FORMAT(
			sample_dataset[Tenant Lease Executed],
			"yyyy-MM-dd HH:mm:ss"
		),
		"Forecast Month Formatted", FORMAT(
			sample_dataset[Forecast Month],
			"yyyy-MM-dd HH:mm:ss"
		)
	)
	ORDER BY
		[Tenant Lease Executed Formatted],
		[Forecast Month Formatted]

 

OwenAuger_0-1741048135387.png

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thanks @OwenAuger ! And thanks for the detailed explanation. At first I thinked was a problem in the dataset I exported from SQL Server to csv, but I checked and seems that exactly the one u described is the problem even in the original dataset. I switched the 3 fields to pure "Date" and numbers do match now.

Thanks again,
Regards!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.