Showing results for 
Search instead for 
Did you mean: 
marijane12 Regular Visitor
Regular Visitor

If condition


I am trying to make a condition: If column month>=month(now);sum(X);sum(y)

The problem is that when I make the condition I can only put measures and functions. I don't have the option to reference columns why? 



Super User
Super User

Re: If condition

Hi @marijane12 


Basically Measurs dont work with row context so you need to use MAX or MIN, something like below.

If MAX(column month )> = MONTH( TODAY() );sum(X);sum(y)

Please read the article below for more info.



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

marijane12 Regular Visitor
Regular Visitor

Re: If condition

Hi @Mariusz 


I try 

Valor total = if(MAX(Doc_Factura[Mês])>=MONTH(TODAY());[Facturação Bruta];[SumValorPub])
but I keep receiving the error:

"Dax comparison operations do not support comparing values of type text with values of type integer."


Doc_Factura[Mês],month(today()), Facturação bruta; sumValorPub are integers and decimals  so I don't understand the error.

I try to make a new column with funtion value but the error was the same

IF(VALUE(MONTH(Doc_Factura[data_doc_df]))<=VALUE(MONTH(TODAY()));[Facturação Bruta];[SumValorPub])
Super User
Super User

Re: If condition

Check your tables.  Make sure that PBI recognizes that Doc_Factura[Mes] is an integer value and not a string.

Otherwise, using VALUE should have worked to force a type change.

marijane12 Regular Visitor
Regular Visitor

Re: If condition

I already check and it is a integer, that's why I don't understand the error..even if it wasn't the value function should change the type to integer. 

Super User
Super User

Re: If condition

It should, which is why we get to debug this to figure out what's happening.


I know it's obnoxious, but can you make a few new measures, to show what value is being returned at each step?

Test1 = MAX(Doc_Factura[Mês])
Test2 = MONTH(TODAY())
Test3 = [Test1]>=[Test2]
Test4 = [Facturação Bruta]
Test5 = [ValorSumPub]

Hopefully when you put these into a table, all the results make sense, but if there's one that doesn't work properly, we can focus in on that one.  As of right now, I have no idea where your problem is. It all looks like it should work.

Community Support Team
Community Support Team

Re: If condition

Hi @marijane12 ,

Have you solved you problem?

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please share your data sample which could reproduce your issue and your desired output so that we could help further on it.

Best  Regards,



Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 6 members 1,045 guests
Please welcome our newest community members: