-
Notifications
You must be signed in to change notification settings - Fork 158
Change the data type for ChargePeriodStart and ChargePeriodEnd to date
to prevent issues with the runningtotal
measures when more than one billing profile is present.
#1626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request updates the data types for ChargePeriodStart and ChargePeriodEnd from datetimezone to date to resolve running total measure issues in Power BI reports. It revises the column definitions in the KQL table, updates the transformation logic in the query, and refreshes the related documentation and changelog.
- Updated column definitions in the Costs.tmdl file to use date instead of datetimezone.
- Added a transformation step to cast the ChargePeriod columns to date in the KQL query.
- Updated documentation and changelog to reflect the new data type.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/power-bi/kql/Shared.Dataset/definition/tables/Costs.tmdl | Updated column definitions and query transformation for ChargePeriodStart and ChargePeriodEnd. |
docs/power-bi.md | Updated documentation to detail the data type change for ChargePeriodStart. |
docs-mslearn/toolkit/changelog.md | Updated changelog with the data type change details. |
date
to prevent issues with the runningtotal
measures when more than one billing profile is present.
There was a problem hiding this comment.
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 changes the data type for ChargePeriodStart and ChargePeriodEnd in Power BI KQL reports from datetimezone to date to resolve issues with running total measures when multiple billing profiles exist. Key changes include updating the column properties in the Costs.tmdl file (format string, source provider type, and annotations), modifying the M-code transformation step to convert these columns to type date, and updating supporting documentation and changelog entries.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/power-bi/kql/Shared.Dataset/definition/tables/Costs.tmdl | Updates the column definitions and transformation logic for ChargePeriodStart and ChargePeriodEnd. |
docs/power-bi.md | Adds documentation about the data model change regarding ChargePeriodStart column. |
docs-mslearn/toolkit/changelog.md | Adds log entry explaining the change of data types for ChargePeriodStart and ChargePeriodEnd. |
Comments suppressed due to low confidence (2)
src/power-bi/kql/Shared.Dataset/definition/tables/Costs.tmdl:252
- The column's dataType property remains set to 'dateTime' despite the underlying sourceProviderType and transformations switching to a date. For clarity and consistency, consider updating the dataType to 'date'.
column ChargePeriodEnd
src/power-bi/kql/Shared.Dataset/definition/tables/Costs.tmdl:1841
- [nitpick] Consider using a naming convention without spaces for the transformation step (e.g., "ChangedType") to maintain consistency and improve maintainability.
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ChargePeriodEnd", type date}, {"ChargePeriodStart", type date}}),
column ChargePeriodStart | ||
dataType: dateTime | ||
formatString: Mmm d, yyyy | ||
sourceProviderType: datetimeoffset | ||
formatString: Short Date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
lineageTag: 015b4c1a-f072-4c68-8f1b-d5e10c54b97e | ||
summarizeBy: none | ||
sourceColumn: ChargePeriodStart | ||
|
||
annotation SummarizationSetBy = Automatic | ||
|
||
annotation PBI_FormatHint = {"isCustom":true} | ||
annotation UnderlyingDateTimeDataType = Date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
|
||
## Data Model Update: ChargePeriodStart Column for KQL based reports | ||
|
||
- **Column:** `ChargePeriodStart` | ||
- **Old Data Type:** `datetimezone` | ||
- **New Data Type:** `date` | ||
- **Reason for Change:** | ||
- To ensure correct grouping and aggregation by day in Power BI and downstream analytics tools. | ||
- This change eliminates issues with multiple rows per day caused by time and timezone components. | ||
|
||
**Note:** | ||
|
||
- All queries, visuals, and documentation should now treat `ChargePeriodStart` as a `date` type. | ||
- If you previously used DAX or Power Query workarounds to normalize this column, you can now use it directly for daily grouping. | ||
|
||
<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
@@ -251,25 +251,27 @@ table Costs | |||
|
|||
column ChargePeriodEnd | |||
dataType: dateTime | |||
formatString: General Date | |||
sourceProviderType: datetimeoffset | |||
formatString: Short Date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, we should probably use the same format as start dates.
@@MSBrett: you have some new feedback! Please review and resolve all comments and I'll let reviewers know by removing the |
🛠️ Description
Change the data type for ChargePeriodStart and ChargePeriodEnd to date (was datetimezone) to prevent issues with the runningtotal measures when more than one billing profile is present. This issue seems to be related to some costs landing in with dates that don't align to the hour.
Fixes #1614
📷 Screenshots
📋 Checklist
🔬 How did you test this change?
🙋♀️ Do any of the following that apply?
📑 Did you update
docs/changelog.md
?📖 Did you update documentation?