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

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.

Reply
sakamotothais
Helper III
Helper III

Comparison function with if in Dax

 

Good afternoon,
I am trying to compare values ​​between today's date and yesterday's date. And I want to create an alert where it decreases and where it increases from yesterday to today. But I can not get into the Dax function. Anyone have suggestions?

 

Column1 = IF(TODAY()-1 > TODAY(),"+","-")

 

Column2 = IF([value_flt_base], TODAY()-1 >[value_flt_base], TODAY(),"+","-")

 

Thanks

1 ACCEPTED SOLUTION

 

I'm using it as a solution:

 

SUMX (
FILTER (QL2_Alerts, QL2_Alerts[dtt_data_captura] = MAX (QL2_Alerts[dtt_data_captura])),
QL2_Alerts[flt_base])

 

 

View solution in original post

10 REPLIES 10
KHorseman
Community Champion
Community Champion

I do not understand what you're trying to do with these formulas.

 

TODAY() - 1 will give you yesterday's date. So Column1 will always return "-" because yesterday's date is never greater than today's date.

 

Your Column2 is an IF statement with 5 arguments. The IF formula takes 3 arguments: IF(<condition to check>, <result if condition is true>, <result if condition is false>)

 

What does this table even look like? How would you compare one date's value to today's? Is there a date column? I'm not even sure this should be a column. This sounds like the sort of thing that should be a measure but it's very unclear from your examples.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I have three columns.

The Date, Place and Value

I want to compare the Value of yesterday's date d-1 with the value of today's date d0,

to check if there was an increase or decrease between yesterday and today.

In which localities there was increase and which localities had reduction.

 

LocalDateValue
Brazil20170621174.52
EUA20170620157.66
EUA 20170621487.69
Brazil 20170620497.65

 

Thanks 

Do you have a date table?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Yes I have

 

 

dtt_date
6/20/2017
6/20/2017
6/20/2017
6/20/2017
6/21/2017
6/21/2017
6/21/2017
6/21/2017

I want to use a Dax calculation that checks the variance by selecting yesterday's date and today's date in the result, which increased and decreased.

This measure would return the difference between one day and the previous day. Not literally today and yesterday unless you give it today's date from the date table, but any 2 day period based on the date from your date table.

 

Daily Variance = SUM(TableName[Value]) - CALCULATE(
	DATEADD(DateTable[dtt_date], -1, day)
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




It does not work for me. I want to bring a measure of only the result of today's date. A measure that filters only the sum of today's date.

Use your date table and show this measure next to today's date.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




 

I do not know how, I want to fix this measurement of today date. And compare with other reporting dates through filters. But today it has to be fixed.

 

Something like

CALCULATE(SUM(QL2_Alerts[flt_base],TODAY()))

 

I'm using it as a solution:

 

SUMX (
FILTER (QL2_Alerts, QL2_Alerts[dtt_data_captura] = MAX (QL2_Alerts[dtt_data_captura])),
QL2_Alerts[flt_base])

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.