ADVERTISEMENT
  • About
  • Advertise
  • Privacy & Policy
  • Contact
Office Learner
ADVERTISEMENT
  • Home
  • Excel
  • Word
  • PowerPoint
  • Outlook
  • Microsoft Copilot
  • Power BI
  • Microsoft 365
  • Microsoft Teams
  • OneNote
No Result
View All Result
  • Home
  • Excel
  • Word
  • PowerPoint
  • Outlook
  • Microsoft Copilot
  • Power BI
  • Microsoft 365
  • Microsoft Teams
  • OneNote
No Result
View All Result
Office Learner
No Result
View All Result
Home Power BI

Classify a variance direction with Number Sign in Power Query

Tanjila Rashid by Tanjila Rashid
December 3, 2026
in Power BI
0
Classify a variance direction with Number Sign in Power Query
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

Classify a variance direction with Number Sign in Power Query

Use Number.Sign in a Power Query custom column to distinguish positive, negative, and zero values without changing the original variance. The result is 1, -1, or 0 respectively. A null input produces null. This is useful when you want a direction flag beside a numerical difference, rather than replacing the difference with a label that hides its size. This guide uses a fictional workshop stock check, with expected results calculated from the documented function behavior rather than a claimed application test.

Decide what the sign means

Suppose a workshop planned to use twelve sheets of card. One session used fifteen sheets, another used nine, and a third used twelve. Define Variance as actual usage minus planned usage. Those three differences are positive three, negative three, and zero. With this definition, a positive value means more material was used than planned. It does not automatically mean good performance. Write the subtraction order in your query notes so another person does not interpret the flag backwards.

ADVERTISEMENT

A fourth session has no recorded usage yet. Represent that missing measurement as null rather than zero. Zero says that the quantities matched; null says that a measurement is unavailable. Combining those meanings would make a summary misleading. Number.Sign preserves the distinction because a null input returns null. Keep the original actual and planned quantities available when investigating a discrepancy, even if a final report only displays the difference and direction.

Build a small practice table

In Power BI Desktop, use Home and Enter data to create a practice table with Session and Variance columns. Enter Morning with 3, Afternoon with -3, Evening with 0, and Unrecorded with an empty variance cell. Open Transform data to inspect the query. Confirm that Variance has a numeric data type and that the unrecorded row appears as null. If it contains an empty text string instead, correct the practice input before continuing. Text and missing numbers are different data problems.

Choose Add Column and Custom Column in Power Query Editor. Name the new field Direction and enter Number.Sign([Variance]) as the expression. The custom column dialog accepts the expression without an initial Excel equals sign. Confirm the dialog, then inspect all four rows before closing the editor. Menu wording can vary with the current Desktop build and display language. This is Power Query M inside the query editor, rather than a DAX calculated column in the report model.

Check each expected result

Morning should return 1 because three is positive. Afternoon should return -1 because negative three lies below zero. Evening should return 0. The unrecorded session should remain null. These four cases form a better check than one positive example: they exercise both directions, the boundary, and the missing input. If any result disagrees, inspect the source value and the formula before adding further transformations. A correct-looking column name does not prove that it references the intended field.

Now change Morning to 0.5 in the practice source. Its direction should still be 1. Change Afternoon to -0.5 and expect -1. The output describes direction rather than magnitude: three and one half have the same positive sign. Consequently, adding Direction values is not a substitute for adding Variance values. One large positive difference and several small negative differences could produce a negative count of directions while their total numerical variance remains positive.

Use the flag without hiding context

A sensible final table might retain Session, Variance, and Direction. Readers can sort or filter by Direction while still seeing the quantity involved. Explain the code in a visible legend: 1 means above plan, -1 means below plan, and 0 means matched plan. If you later create friendly text labels, preserve a separate missing state. Avoid labeling every nonpositive result as below plan, because zero belongs in its own category and null has not supplied a measurement.

The function does not apply a tolerance. A tiny positive residual is still positive. When measured quantities need an agreed rounding rule or a permitted tolerance, document that separate business rule before classifying direction. Do not quietly round all values merely to make the display appear cleaner. A displayed zero may conceal a small stored difference. Inspect the underlying value when a visible zero receives a positive or negative flag, and decide whether the source precision is appropriate for your task.

Troubleshoot the expression

If the column errors, check that you entered Number.Sign with its documented capitalization and supplied a numeric field. A column named Variance Amount requires the matching field reference [Variance Amount]. Do not paste a quoted column name as the argument; that supplies text instead of a row value. If the source contains numbers stored as text, investigate conversion and locale before applying the function. Keep conversion errors visible until you understand them instead of replacing every error with zero.

Before applying the query, check whether the new field needs an explicit numeric type for downstream work. Refresh the practice table after changing the source and verify that the direction recalculates. Power Query transformations run when the query evaluates; this is not an interactive cell formula that updates independently inside a report visual. Keep the applied step so a colleague can inspect the calculation and its position relative to any cleaning or rounding steps.

Try a direction audit

Create five practice differences: 8, -2, 0, null, and -0.25. Predict their flags on paper before evaluating the query. The expected sequence is 1, -1, 0, null, and -1. Then reverse the subtraction definition from actual minus planned to planned minus actual. Which flags change, and which stay the same? Explain why the missing measurement remains missing. This exercise checks both your understanding of the function and the meaning you intend readers to attach to the result.

Sources and related reading

Primary reference

Split a Combined Code in Power BI Power Query

Tags: Power BIworked example
ADVERTISEMENT
Previous Post

Format a quoted phrase with italics in OneNote for the web

Next Post

Remove one hyperlink from a Word handout while keeping its text

Tanjila Rashid

Tanjila Rashid

Next Post
Remove one hyperlink from a Word handout while keeping its text

Remove one hyperlink from a Word handout while keeping its text

ADVERTISEMENT
  • Trending
  • Comments
  • Latest
10 Microsoft 365 Copilot Features That Transform Word and Outlook in 2025

8 Hidden Excel Features That Power Users Swear By (2026 Edition)

October 8, 2026
PowerPoint Morph Transition Masterclass: Create Cinematic Animations in 2026

PowerPoint Morph Transition Masterclass: Create Cinematic Animations in 2026

October 8, 2026
Excel GROUPBY & PIVOTBY: The New Array Functions That Replace PivotTables

Excel GROUPBY & PIVOTBY: The New Array Functions That Replace PivotTables

October 8, 2026
Excel PIVOTBY Function in 2026: The Ultimate Guide to Dynamic Pivot Analysis Without Pivot Tables

Excel PIVOTBY Function in 2026: The Ultimate Guide to Dynamic Pivot Analysis Without Pivot Tables

October 8, 2026
Spreadsheet Layout

What is spreadsheet? and how it works!

0
Spreadsheet Layout

Spreadsheet Layout

0
Spreadsheet Layout

IF function of Google Sheets – usage and formula examples

0

5 Google Sheets tricks that you always need!

0
Change the font size of one instruction in OneNote for the web

Change the font size of one instruction in OneNote for the web

December 3, 2026
Use PowerPoint gridlines as temporary placement references

Use PowerPoint gridlines as temporary placement references

December 3, 2026
Put two workshop label lines in one Excel cell with CHAR

Put two workshop label lines in one Excel cell with CHAR

December 3, 2026
Remove one hyperlink from a Word handout while keeping its text

Remove one hyperlink from a Word handout while keeping its text

December 3, 2026

Recent News

Change the font size of one instruction in OneNote for the web

Change the font size of one instruction in OneNote for the web

December 3, 2026
Use PowerPoint gridlines as temporary placement references

Use PowerPoint gridlines as temporary placement references

December 3, 2026
Put two workshop label lines in one Excel cell with CHAR

Put two workshop label lines in one Excel cell with CHAR

December 3, 2026
Remove one hyperlink from a Word handout while keeping its text

Remove one hyperlink from a Word handout while keeping its text

December 3, 2026
Office Learner

OfficeLearner is a place where you can learn PowerPoint, Excel, Word Data Analysis, and other Office related programs. We provide tips, how to guide and also provide Excel solutions to your business problems

Follow Us

DMCA.com Protection Status

Browse by Category

  • Clipchamp
  • Excel
  • Google Sheets
  • Loop
  • Microsoft 365
  • Microsoft Copilot
  • Microsoft Designer
  • Microsoft Forms
  • Microsoft Loop
  • Microsoft Sway
  • Microsoft Teams
  • Microsoft Viva
  • Microsoft Whiteboard
  • OneDrive
  • OneNote
  • Outlook
  • Planner
  • Power Apps
  • Power Automate
  • Power BI
  • PowerPoint
  • SharePoint
  • Teams
  • Visio
  • Word

Recent News

Change the font size of one instruction in OneNote for the web

Change the font size of one instruction in OneNote for the web

December 3, 2026
Use PowerPoint gridlines as temporary placement references

Use PowerPoint gridlines as temporary placement references

December 3, 2026
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2022 OfficeLearner - Free Excel, PowerPoint & Word Tutorial & Online Courses

No Result
View All Result

© 2022 OfficeLearner - Free Excel, PowerPoint & Word Tutorial & Online Courses

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.