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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Get the Text to work in the query

I am creating an 'IF' Query giving numbers between two values a text outcome but the text causes an error and I don't know why. Can someone please assist me? It's probably a simple fix.

 

The entire formula worked until I put text in after then.

Could you take a look and see if you know the solution:

 

IF ([CancelTime] - [StartTime]) >= Time.Minute(10) & ([CancelTime] - [StartTime]) <= Time.Minute (18) then "Yes" else ""

 

only the "Yes" is failing and I can't seem to resolve it.

 

I am writing this within the transform data section within 'Custom Column'

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

You will need to use this query.

1. In PQ, null is used not "" unlike Excel and DAX (though you can use "" also).

2. PQ is super case sensitive 

3. For AND condition and is used not &.

= if Duration.TotalMinutes([CancelTime] - [StartTime]) >= 10 and Duration.TotalMinutes([CancelTime] - [StartTime]) <= 18 then "Yes" else null

View solution in original post

3 REPLIES 3
watkinnc
Super User
Super User

You are trying to transform a time or number to text. I would use them true else false, then change to text later.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
Vijay_A_Verma
Super User
Super User

You will need to use this query.

1. In PQ, null is used not "" unlike Excel and DAX (though you can use "" also).

2. PQ is super case sensitive 

3. For AND condition and is used not &.

= if Duration.TotalMinutes([CancelTime] - [StartTime]) >= 10 and Duration.TotalMinutes([CancelTime] - [StartTime]) <= 18 then "Yes" else null
Anonymous
Not applicable

It worked!

Thanks, @Vijay_A_Verma for solving the query! That was very helpful.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors