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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Calculate the sum of a column based on a date

Hi, I'm trying to calculate the difference beetwen the sum of two columns from two tables based on a date in a new table 

 

3.jpg

 

 

 

 

 

The variable suma_hoy is working perfectly, but the variable sum_pasada  is gives me the follow error: 

"DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values."

I've checked the type of my column Seguimiento_fecha, and it seems to be correct:

2.png

 

Why am I getting that error? How should calculate that difference properly?

1 ACCEPTED SOLUTION

Try replace now() with today()

Tutu_in_YYC_0-1647616468632.png

 

View solution in original post

4 REPLIES 4
Tutu_in_YYC
Super User
Super User

Hi Pumpikin,
In line 2 for the variable days_before, NOW() returns a date and time. Try using TODAY() that returns date only. 

The function FORMAT turns the value into a Text, so it cant be compared with a data.

try this for your days_before:

VAR days_before = TODAY() - 7

 

Anonymous
Not applicable

Hi Tutu, thanks for your help, but still not working. 

4.png

The filter is no working properly, I think is because now() is retrieving as dd/mm/yyyy HH:mm:ss and the column in my table is dd/mm/yyyy so they are not matching. 

Try replace now() with today()

Tutu_in_YYC_0-1647616468632.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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