The (Almost) Definitive Guide to Query Folding

There’s only one rule. Don’t break the fold! Before we start enforcing all these rules, we should start with something like a solid foundation of what does and doesn’t fold in Power Query and their SQL equivalents. Now, if you found this page and we’re like “what in the world is query folding?” read this incredible article, from this amazing author.

The disclaimer thing: This is a personal list compiled through testing during the 30-day query folding challenge either done by myself or members of the community (❤️). Every scenario is different, and every situation is unique. The functionality described in this article is subject to change and may evolve over time. Please feel free to leave comments at the end of the article or find me via the social channels to let me know of revisions.

About the data source: The source utilized for these scenarios was an Azure SQL Database or SQL Server. There may not be equal folding functionality within other systems, and you should always test your own solutions to determine full functionality before production use.

NameSupports FoldingSQL Equivalent
Binary.BufferFALSE
Binary.CompressFALSE
Binary.ApproximateLengthFALSE
Binary.DecompressFALSE
Binary.ViewErrorFALSE
Binary.ToTextFALSE
Binary.TypeFALSE
Binary.ViewFALSE
Binary.ViewFunctionFALSE
Binary.CombineFALSE
Binary.ToListFALSE
Binary.RangeFALSE
Binary.FromListFALSE
Binary.LengthFALSE
Binary.InferContentTypeFALSE
Binary.FromFALSE
Binary.FromTextFALSE
Byte.TypeFALSE
Byte.FromFALSE
Character.FromNumberFALSECHAR
Character.ToNumberFALSE
Currency.TypeFALSE
Currency.FromFALSE
Date.IsLeapYearFALSE
Date.FromFALSE
Date.StartOfDayFALSE
Date.MonthNameFALSE
Date.EndOfYearFALSE
Date.EndOfDayFALSE
Date.DaysInMonthFALSE
Date.EndOfWeekFALSE
Date.EndOfQuarterFALSE
Date.WeekOfMonthFALSE
Date.ToTextFALSE
Date.TypeFALSE
Date.FromTextFALSE
Date.ToRecordFALSE
Date.StartOfQuarterFALSE
Date.StartOfMonthFALSE
Date.StartOfYearFALSE
Date.StartOfWeekFALSE
Date.DayOfWeekNameFALSEDATENAME
Date.IsInCurrentDayTRUE
Date.IsInCurrentMonthTRUE
Date.EndOfMonthTRUEEOMONTH
Date.WeekOfYearTRUEDATEPART
Date.YearTRUEDATEPART
Date.IsInNextDayTRUE
Date.IsInNextMonthTRUE
Date.IsInCurrentYearTRUE
Date.IsInCurrentQuarterTRUE
Date.IsInCurrentWeekTRUE
Date.AddWeeksTRUEDATEADD
Date.AddYearsTRUEDATEADD
Date.AddQuartersTRUEDATEADD
Date.AddDaysTRUEDATEADD
Date.AddMonthsTRUEDATEADD
Date.MonthTRUEDATEPART
Date.QuarterOfYearTRUEDATEPART
Date.DayOfYearTRUEDATEPART
Date.DayTRUEDATEPART
Date.DayOfWeekTRUEDATEPART
Date.IsInPreviousNQuartersTRUE
Date.IsInPreviousNWeeksTRUE
Date.IsInPreviousNMonthsTRUE
Date.IsInPreviousMonthTRUE
Date.IsInPreviousNDaysTRUE
Date.IsInPreviousYearTRUE
Date.IsInYearToDateTRUE
Date.IsInPreviousWeekTRUE
Date.IsInPreviousNYearsTRUE
Date.IsInPreviousQuarterTRUE
Date.IsInNextNQuartersTRUE
Date.IsInNextNWeeksTRUE
Date.IsInNextNDaysTRUE
Date.IsInNextNMonthsTRUE
Date.IsInNextNYearsTRUE
Date.IsInPreviousDayTRUE
Date.IsInNextYearTRUE
Date.IsInNextQuarterTRUE
Date.IsInNextWeekTRUE
DateTime.FromTextFALSE
DateTime.TypeFALSE
DateTime.IsInPreviousNSecondsTRUE
DateTime.IsInPreviousSecondTRUE
DateTime.IsInPreviousNMinutesTRUE
DateTime.IsInPreviousMinuteTRUE
DateTime.IsInPreviousNHoursTRUE
DateTime.LocalNowTRUE
DateTime.TimeFALSE
DateTime.ToRecordFALSE
DateTime.FixedLocalNowFALSE
DateTime.AddZoneFALSE
DateTime.DateFALSE
DateTime.IsInPreviousHourTRUE
DateTime.IsInCurrentMinuteTRUE
DateTime.IsInCurrentSecondTRUE
DateTime.IsInCurrentHourTRUE
DateTime.FromTRUECONVERT
DateTime.FromFileTimeTRUE
DateTime.IsInNextHourTRUE
DateTime.IsInNextNSecondsTRUE
DateTime.IsInNextSecondTRUE
DateTime.IsInNextNMinutesTRUE
DateTime.IsInNextMinuteTRUE
DateTime.IsInNextNHoursTRUE
DateTime.ToTextFALSE
DateTimeZone.ToUtcFALSE
DateTimeZone.ToTextFALSE
DateTimeZone.ZoneHoursFALSE
DateTimeZone.ToRecordFALSE
DateTimeZone.ZoneMinutesFALSE
DateTimeZone.RemoveZoneFALSE
DateTimeZone.FromTextFALSE
DateTimeZone.SwitchZoneFALSE
DateTimeZone.FromFALSE
DateTimeZone.ToLocalFALSE
DateTimeZone.FixedUtcNowTRUE
DateTimeZone.FromFileTimeTRUE
DateTimeZone.TypeFALSE
DateTimeZone.FixedLocalNowTRUE
DateTimeZone.UtcNowTRUE
DateTimeZone.LocalNowTRUE
Decimal.TypeFALSE
Decimal.FromTRUE
Double.TypeFALSE
Double.FromTRUECONVERT
Duration.MinutesFALSE
Duration.TypeFALSE
Duration.TotalMinutesFALSE
Duration.TotalSecondsFALSE
Duration.TotalHoursFALSE
Duration.SecondsFALSE
Duration.ToRecordFALSE
Duration.ToTextFALSE
Duration.DaysFALSE
Duration.TotalDaysTRUEDATEDIFF
Duration.FromFALSE
Duration.HoursFALSE
Duration.FromTextFALSE
Guid.FromFALSE
Guid.TypeFALSE
Int16.FromFALSE
Int16.TypeFALSE
Int32.TypeFALSE
Int32.FromFALSE
Int64.TypeFALSE
Int64.FromFALSE
Int8.FromFALSE
Int8.TypeFALSE
Json.FromValueFALSE
Json.DocumentFALSE
List.SingleOrDefaultFALSE
List.SkipFALSE
List.SplitFALSE
List.SingleFALSE
List.ReplaceRangeFALSE
List.ReplaceValueFALSE
List.ReverseFALSE
List.StandardDeviationFALSE
List.TypeFALSE
List.UnionFALSE
List.ZipFALSE
List.TransformManyFALSE
List.SumFALSE
List.TimesFALSE
List.TransformFALSE
List.ReplaceMatchingItemsFALSE
List.DistinctFALSE
List.DurationsFALSE
List.FindTextFALSE
List.DifferenceFALSE
List.DatesFALSE
List.DateTimesFALSE
List.DateTimeZonesFALSE
List.IntersectFALSE
List.IsDistinctFALSE
List.IsEmptyFALSE
List.InsertRangeFALSE
List.FirstFALSE
List.FirstNFALSE
List.GenerateFALSE
List.CovarianceFALSE
List.SortTRUE
List.AccumulateFALSE
List.AllTrueFALSE
List.SelectTRUE
List.ContainsTRUEIN
List.CombineTRUE
List.RemoveItemsTRUE
List.ContainsAllFALSE
List.ContainsAnyFALSE
List.CountFALSE
List.BufferFALSE
List.AlternateFALSE
List.AnyTrueFALSE
List.AverageFALSE
List.LastFALSE
List.PositionsFALSE
List.ProductFALSE
List.RandomFALSE
List.PositionOfAnyFALSE
List.NonNullCountFALSE
List.NumbersFALSE
List.PositionOfFALSE
List.RemoveNullsFALSE
List.RemoveRangeFALSE
List.RepeatFALSE
List.RemoveMatchingItemsFALSE
List.RangeFALSE
List.RemoveFirstNFALSE
List.RemoveLastNFALSE
List.ModesFALSE
List.MinNFALSE
List.ModeFALSE
List.MaxNFALSE
List.MinFALSE
List.MaxFALSE
List.LastNFALSE
List.MedianFALSE
List.MatchesAnyFALSE
List.MatchesAllFALSE
Logical.ToTextFALSE
Logical.FromTextFALSE
Logical.TypeFALSE
Logical.FromFALSE
Null.TypeFALSE
Number.SinhFALSE
Number.SinFALSE
Number.TypeFALSE
Number.TanhFALSE
Number.ExpTRUEEXP
Number.RoundDownTRUEFLOOR
Number.CosTRUECOS
Number.FromTRUECONVERT
Number.ToTextTRUECONVERT
Number.PowerTRUEPOWER
Number.RoundTRUEROUND
Number.ModTRUEMOD
Number.LogTRUELOG
Number.Log10TRUELOG10
Number.EpsilonTRUE4.940656458412465E-324
Number.AbsTRUEABS
Number.PiTRUE
Number.PositiveInfinityFALSE
Number.ETRUE
Number.Atan2TRUEATN2
Number.RoundUpTRUECEILING
Number.AtanTRUEATAN
Number.AcosTRUEACOS
Number.AsinTRUEASIN
Number.SqrtTRUESQRT
Number.IsEvenFALSE
Number.IsNaNFALSE
Number.IntegerDivideFALSE
Number.FactorialFALSE
Number.FromTextFALSE
Number.NegativeInfinityFALSE
Number.PermutationsFALSE
Number.NaNFALSE
Number.IsOddFALSE
Number.LnFALSE
Number.BitwiseNotFALSE
Number.BitwiseOrFALSE
Number.BitwiseAndFALSE
Number.TanTRUETAN
Number.RandomTRUE
Number.CombinationsFALSE
Number.CoshFALSE
Number.BitwiseXorFALSE
Number.BitwiseShiftLeftFALSE
Number.BitwiseShiftRightFALSE
Number.RoundTowardZeroFALSE
Number.RandomBetweenFALSE
Number.RoundAwayFromZeroFALSE
Number.SignFALSE
Percentage.TypeFALSE
Percentage.FromFALSE
Single.TypeFALSE
Single.FromFALSE
Table.ColumnFALSE
Table.BufferFALSE
Table.TransposeTRUE
Table.UnpivotOtherColumnsTRUE
Table.TransformColumnNamesTRUE
Table.AddIndexColumnFALSE
Table.UnpivotTRUE
Table.AddKeyFALSE
Table.AlternateRowsFALSE
Table.AggregateTableColumnFALSE
Table.ColumnCountFALSE
Table.ReplaceMatchingRowsFALSE
Table.ReplaceRelationshipIdentityFALSE
Table.ReplaceKeysFALSE
Table.AddJoinColumnFALSE
Table.ReplaceErrorValuesFALSE
Table.TransformRowsFALSE
Table.ViewFunctionFALSE
Table.TransformColumnTypesFALSE
Table.ReplaceRowsFALSE
Table.ToColumnsFALSE
Table.ReorderColumnsTRUE
Table.RangeTRUETOP
Table.FirstNTRUETOP
Table.SelectColumnsTRUESELECT
Table.SelectRowsTRUEWHERE
Table.RepeatTRUEUNION ALL
Table.CombineTRUEUNION ALL
Table.DistinctTRUEDISTINCT
Table.ReplaceValueTRUECASE
Table.PrefixColumnsFALSE
Table.PivotTRUEPIVOT
Table.SortTRUEORDER BY
Table.GroupTRUEGROUP BY
Table.AddColumnTRUE
Table.NestedJoinTRUE
Table.JoinTRUE
Table.FromPartitionsTRUE
Table.RenameColumnsTRUE
Table.RemoveColumnsTRUE
Table.PartitionTRUE
Table.DuplicateColumnTRUE
Table.ColumnsOfTypeTRUE
Table.ColumnNamesTRUE
Table.ExpandTableColumnTRUE
Table.ExpandRecordColumnTRUE
Table.ExpandListColumnTRUE
Table.FuzzyNestedJoinFALSE
Table.HasColumnsFALSE
Table.InsertRowsFALSE
Table.FromValueFALSE
Table.FuzzyGroupFALSE
Table.FuzzyJoinFALSE
Table.IsDistinctFALSE
Table.LastNFALSE
Table.MatchesAllRowsFALSE
Table.MatchesAnyRowsFALSE
Table.IsEmptyFALSE
Table.KeysFALSE
Table.LastFALSE
Table.FromRowsFALSE
Table.DemoteHeadersFALSE
Table.FillDownFALSE
Table.FillUpFALSE
Table.ContainsFALSE
Table.ContainsAllFALSE
Table.ContainsAnyFALSE
Table.FilterWithDataTableFALSE
Table.FromColumnsFALSE
Table.FromListFALSE
Table.FromRecordsFALSE
Table.FindTextFALSE
Table.FirstFALSE
Table.FirstValueFALSE
Table.MaxTRUETOP
Table.SelectRowsWithErrorsFALSE
Table.SingleRowFALSE
Table.SkipFALSE
Table.ReverseRowsFALSE
Table.RowCountFALSE
Table.SchemaFALSE
Table.SplitFALSE
Table.ToRowsFALSE
Table.TransformColumnsFALSE
Table.ViewFALSE
Table.SplitColumnFALSE
Table.ToListFALSE
Table.ToRecordsFALSE
Table.RemoveRowsWithErrorsFALSE
Table.PartitionValuesFALSE
Table.PositionOfFALSE
Table.PositionOfAnyFALSE
Table.MaxNTRUETOP
Table.MinTRUETOP
Table.MinNTRUETOP
Table.CombineColumnsFALSE
Table.RemoveLastNFALSE
Table.RemoveMatchingRowsFALSE
Table.RemoveRowsFALSE
Table.ProfileFALSE
Table.PromoteHeadersFALSE
Table.RemoveFirstNFALSE
Text.ToBinaryFALSE
Text.ToListFALSE
Text.SplitAnyFALSE
Text.SelectFALSE
Text.SplitFALSE
Text.AfterDelimiterFALSE
Text.RangeFALSESUBSTRING
Text.BeforeDelimiterFALSE
Text.TypeFALSE
Text.BetweenDelimitersFALSE
Text.RemoveRangeFALSE
Text.InsertFALSE
Text.MiddleFALSE
Text.InferNumberTypeFALSE
Text.FormatFALSE
Text.FromBinaryFALSE
Text.CleanFALSE
Text.RemoveFALSE
Text.PositionOfAnyFALSE
Text.PadEndFALSE
Text.PadStartFALSE
Text.AtFALSESUBSTRING
Text.StartTRUELEFT
Text.FromTRUECONVERT
Text.LengthTRUELEN
Text.TrimStartTRUELTRIM
Text.LowerTRUELOWER
Text.ContainsTRUECASE
Text.ProperFALSE
Text.EndsWithTRUECASE
Text.CombineTRUECONCAT
Text.StartsWithTRUECASE
Text.PositionOfFALSECHARINDEX
Text.NewGuidTRUE
Text.RepeatFALSEREPLICATE
Text.ReplaceRangeFALSESTUFF
Text.ReverseFALSEREVERSE
Text.EndTRUERIGHT
Text.ReplaceTRUEREPLACE
Text.TrimEndTRUERTRIM
Text.UpperTRUEUPPER
Text.TrimTRUETRIM
Time.TypeFALSE
Time.ToTextFALSE
Time.SecondFALSE
Time.ToRecordFALSE
Time.StartOfHourFALSE
Time.FromTextFALSE
Time.EndOfHourFALSE
Time.FromFALSE
Time.HourFALSE
Time.MinuteFALSE
Value.AddFALSE
Value.CompareFALSE
Value.DivideFALSE
Value.MultiplyFALSE
Value.EqualsTRUECASE
Value.AsTRUE
Value.FromTextFALSE
Value.NullableEqualsFALSE
Value.FirewallFALSE
Value.RemoveMetadataFALSE
Value.ReplaceTypeFALSE
Value.ReplaceMetadataFALSE
Value.MetadataFALSE
Value.IsFALSE
Value.ResourceExpressionFALSE
Value.SubtractFALSE
Value.NativeQueryFALSE

4 thoughts on “The (Almost) Definitive Guide to Query Folding

  1. This is a great resource.

    I am trying to get the domain from an email address. However, unfortunately, folding is not working with Text.PositionOf against a SQL Server on prem data source in a Dataflow Gen2. The folding indicator is displaying “Analysis on this step was inconclusive.”

    1. The folding indicators are a “guide” but not always the truth is what I have found at times, if you check the logs against the SQL Server does it say if the statement is being properly generated?

    1. As the engineering team adds support for more functions to fold, I absolutely try to keep this updated. Or if you find something that works that I did not have documented, please let me know.

Questioning My Mental Health?