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
michellepace
Resolver III
Resolver III

Test for whole number?

Hello,

Is there a better way to test for a whole number than the below? I can't help but think there simply HAS to be a built-in function?

 

= if Number.Mod([Task ID], 1) = 0 then true else false

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @michellepace ,

You can create a custom column like this:

= Table.AddColumn(#"Changed Type", "Custom", each if [Task ID] = Int64.From([Task ID]) then true else false)

number.png

 

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

View solution in original post

3 REPLIES 3
watkinnc
Super User
Super User

You can use Value.Is:

 

Table.AddColumn(PriorStep, "Whole Number", each Value.Is([Task ID], Int64.Type))

 

Or if you need it as a filter, you can also use "if" syntax

if Value.Is([Task ID], Int64.Type) then xxx else yyy

--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!!
v-yingjl
Community Support
Community Support

Hi @michellepace ,

You can create a custom column like this:

= Table.AddColumn(#"Changed Type", "Custom", each if [Task ID] = Int64.From([Task ID]) then true else false)

number.png

 

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

Fowmy
Super User
Super User

@michellepace 

 

The logic is the same but you can get rid of the IF:

Number.Mod([TASKID],1)=0

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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