Skip to content

[pbi-fixer] Add add_calculated_calendar: add a comprehensive CalcCalendar calculated table if no calendar exists - #1211

Open
KornAlexander wants to merge 3 commits into
microsoft:mainfrom
KornAlexander:feature/add-calculated-calendar
Open

[pbi-fixer] Add add_calculated_calendar: add a comprehensive CalcCalendar calculated table if no calendar exists#1211
KornAlexander wants to merge 3 commits into
microsoft:mainfrom
KornAlexander:feature/add-calculated-calendar

Conversation

@KornAlexander

Copy link
Copy Markdown

Adds a sempy_labs fixer add_calculated_calendar() that add a comprehensive CalcCalendar calculated table if no calendar exists.

Adds one source file (src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.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:39

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 sempy_labs.semantic_model utility/fixer function, add_calculated_calendar(), intended to ensure a semantic model backing a given report has a comprehensive Time-category calendar table (creating CalcCalendar when none exists).

Changes:

  • Introduces add_calculated_calendar() which detects existing Time-category tables and otherwise creates a CalcCalendar calculated table with columns, sort-by settings, hierarchies, and optional/auto relationships.
  • Adds a semantic-model refresh call to calculate the newly created table.
  • Re-exports add_calculated_calendar from sempy_labs.semantic_model.

Reviewed changes

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

File Description
src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.py Implements add_calculated_calendar() including DAX definition, metadata setup, relationship auto-detection, and refresh.
src/sempy_labs/semantic_model/__init__.py Re-exports add_calculated_calendar via __all__.

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

Comment thread src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.py Outdated
Comment thread src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.py Outdated
Comment thread src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.py
Comment thread src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.py
Comment thread src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.py
Comment thread src/sempy_labs/semantic_model/_Add_CalculatedTable_Calendar.py Outdated
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