Skip to content

[pbi-fixer] Add fix_whole_number_format: set #,0 format on integer measures - #1201

Open
KornAlexander wants to merge 3 commits into
microsoft:mainfrom
KornAlexander:feature/fix-whole-number-format
Open

[pbi-fixer] Add fix_whole_number_format: set #,0 format on integer measures#1201
KornAlexander wants to merge 3 commits into
microsoft:mainfrom
KornAlexander:feature/fix-whole-number-format

Conversation

@KornAlexander

Copy link
Copy Markdown

Adds a sempy_labs fixer fix_whole_number_format() that set #,0 format on integer measures.

Adds one source file (src/sempy_labs/semantic_model/_Fix_WholeNumberFormat.py) plus one re-export line in the matching __init__.py. No other files touched, no shared helpers, no dependency on any other PR.

Part of the PBI Fixer contribution. Tracking issue: #1185

Copilot AI review requested due to automatic review settings May 5, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new semantic-model fixer, fix_whole_number_format(), intended to standardize formatting for whole-number measures in the sempy_labs.semantic_model surface area as part of the PBI Fixer contribution tracked in #1185.

Changes:

  • Adds fix_whole_number_format() in a new standalone module under semantic_model.
  • Scans measures in a semantic model and assigns #,0 when the fixer decides a measure is an unformatted whole number.
  • Re-exports the new fixer from sempy_labs.semantic_model.__init__.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/sempy_labs/semantic_model/_Fix_WholeNumberFormat.py Introduces the new fixer implementation that opens the TOM model, scans measures, applies formatting, and reports results.
src/sempy_labs/semantic_model/__init__.py Re-exports the new fixer so it is available from the semantic_model package.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sempy_labs/semantic_model/_Fix_WholeNumberFormat.py Outdated
Comment thread src/sempy_labs/semantic_model/_Fix_WholeNumberFormat.py
Comment thread src/sempy_labs/semantic_model/_Fix_WholeNumberFormat.py Outdated
@KornAlexander

Copy link
Copy Markdown
Author

Thanks copilot-pull-request-reviewer for the review. Addressed all three findings in 127d2b2:

  1. Scope: Now restricted to DataType == Int64 measures only — decimals/currency/duration are no longer touched.
  2. Dynamic format strings: Skip measures with a non-null FormatStringDefinition.
  3. Redundant SaveChanges(): Removed — TOMWrapper.close() persists changes when the context manager exits.

1 similar comment
@KornAlexander

Copy link
Copy Markdown
Author

Thanks copilot-pull-request-reviewer for the review. Addressed all three findings in 127d2b2:

  1. Scope: Now restricted to DataType == Int64 measures only — decimals/currency/duration are no longer touched.
  2. Dynamic format strings: Skip measures with a non-null FormatStringDefinition.
  3. Redundant SaveChanges(): Removed — TOMWrapper.close() persists changes when the context manager exits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants