Skip to content
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

An error occurred in the ‘ftk_LoadData’ query. Expression.Error: The field 'Tags' already exists in the record #493

Closed
preimerSerrala opened this issue Dec 13, 2023 · 12 comments · Fixed by #576
Assignees
Labels
Status: 📦 Pending release Issue will be included in the next release Tool: Power BI Power BI reports Type: Bug 🐛 Something isn't working
Milestone

Comments

@preimerSerrala
Copy link

🐛 Problem

When trying to connect via the Cost Management connector Power BI can't load the data with the error:
An error occurred in the ‘ftk_LoadData’ query. Expression.Error: The field 'Tags' already exists in the record
This occurs on the CostSummary report.

👣 Repro steps

  1. Open the CostSummary Power BI Report
  2. Go to Transform data
  3. Change the connector to "Cost Management connector" and enter the billing account + billing profile IDs
  4. Exit transform data with save and apply

🤔 Expected

The data is getting updated from the Azure Cost Management API

Thank you and best regards,

Pascal

@preimerSerrala preimerSerrala added Needs: Triage 🔍 Untriaged issue needs to be reviewed Type: Bug 🐛 Something isn't working labels Dec 13, 2023
@ghost
Copy link

ghost commented Jan 16, 2024

I have the same problem.

An error occurred in the ‘ftk_LoadData’ query. Expression.Error: The field 'Tags' already exists in the record.
Details:
Name=Tags
Value=

@flanakin flanakin added this to the 0.2 milestone Jan 18, 2024
@flanakin
Copy link
Collaborator

flanakin commented Jan 19, 2024

We separated the connector from hubs due to issues it was causing in the Power BI service. This should be working in the new CostManagementConnector report.

@p-reimer, can you try this new report: https://github.com/microsoft/finops-toolkit/raw/dev/src/power-bi/CostManagementConnector.pbix

@baptistepa, are you also using the Cost Management connector? If so, can you also try that?

I'll move this issue to 0.2.1 to keep track of it, but please do let me know if this resolves the issue.

@flanakin flanakin modified the milestones: 0.2, 0.2.1 Jan 19, 2024
@flanakin flanakin added Status: 📋 Pending confirmation Waiting on explicit confirmation that the issue was resolved in previous release Tool: Power BI Power BI reports and removed Needs: Triage 🔍 Untriaged issue needs to be reviewed labels Jan 19, 2024
@ghost
Copy link

ghost commented Jan 19, 2024

I am getting an error when opening the file...
image

Copy link

Uh oh! @baptistepa, the image you shared is missing helpful alt text. Check #493 (comment).

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

@preimerSerrala
Copy link
Author

Dear Michael,

thank you for the update. Unfortunately with the new report the same issue persists with some additional errors when connecting to a MCA account using the manual input scope.

image

Copy link

Uh oh! @p-reimer, the image you shared is missing helpful alt text. Check #493 (comment).

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

@flanakin flanakin modified the milestones: 0.2.1, 0.3, 0.4 Jan 23, 2024
@flanakin
Copy link
Collaborator

@p-reimer Can you email me at micflan@ms? (Spell out the company name + ".com". Hiding from bots.)

@flanakin
Copy link
Collaborator

I am getting an error when opening the file... image

@baptistepa, can you confirm which file this was? That setting gets reset every time we open the reports, so it's constantly causing issues and we don't have a way to prevent it or automate the value.

@flanakin flanakin added Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity Status: 🕵️‍♀️ Investigating Issue is actively being investigated and removed Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity Status: 📋 Pending confirmation Waiting on explicit confirmation that the issue was resolved in previous release labels Jan 28, 2024
@flanakin flanakin modified the milestones: 0.3, 0.2.1 Feb 1, 2024
@flanakin
Copy link
Collaborator

flanakin commented Feb 3, 2024

Update: Scheduled a meeting with @preimerSerrala to investigate further.

@flanakin
Copy link
Collaborator

flanakin commented Feb 5, 2024

We noticed the connector for MCA has both a tags and a Tags column, which is what's causing the issue. As a quick fix, anyone who is running into this can replace lines 3 and 4 in the CostDetails query with:

    AmortizedDataset_internal = Connector{[Key="usagedetailsamortized"]}[Data],
    ActualDataset_internal = Connector{[Key="usagedetails"]}[Data],

    // TODO: Confirm if Tags ever has data. If it does, merge both tags and Tags columns into a single column.
    AmortizedDataset = if Table.HasColumns(AmortizedDataset_internal, "tags") and Table.HasColumns(AmortizedDataset_internal, "Tags") then Table.RenameColumns(AmortizedDataset_internal, {"Tags", "Tags2"}) else AmortizedDataset_internal,
    ActualDataset    = if Table.HasColumns(ActualDataset_internal,    "tags") and Table.HasColumns(ActualDataset_internal,    "Tags") then Table.RenameColumns(ActualDataset_internal,    {"Tags", "Tags2"}) else ActualDataset_internal,

Please note this is a quick fix. I am not sure why there are 2 columns for tags. Ideally, we should be merging both into a single column. This renames one so you will see Tags and __NEW_Tags2. The "_NEW" prefix is something we have to help us catch unexpected columns. We'll make sure that's address in the 0.2.1 update. This is just a quick workaround. Apologies for the inconvenience 😥

@flanakin
Copy link
Collaborator

flanakin commented Feb 5, 2024

We also noticed an issue with the recommendation queries for MCA where some columns were missing. You can replace those with the following:

let
    Source = ftk_Connector("rirecommendationsshared"),
    NormalizedSize = if Table.HasColumns(Source, "normalizedSize") then Source else Table.AddColumn(Source, "normalizedSize", each null),
    RecommendedQuantityNormalized = if Table.HasColumns(NormalizedSize, "recommendedQuantityNormalized") then NormalizedSize else Table.AddColumn(NormalizedSize, "recommendedQuantityNormalized", each null, Int64.Type),
    SelectColumns = Table.SelectColumns(RecommendedQuantityNormalized, {"meterId", "term", "costWithNoReservedInstances", "recommendedQuantity", "totalCostWithReservedInstances", "netSavings", "firstUsageDate", "scope", "lookBackPeriod", "instanceFlexibilityRatio", "instanceFlexibilityGroup", "normalizedSize", "recommendedQuantityNormalized", "skuProperties"}),
    ChangeType = Table.TransformColumnTypes(SelectColumns, {{"instanceFlexibilityRatio", Int64.Type}, {"recommendedQuantityNormalized", Int64.Type}})
in
    ChangeType

Please note the Source line is different between each of these:

  • For RecommendationsSingle, use: Source = ftk_Connector("rirecommendationssingle"),
  • For RecommendationsShared, use: Source = ftk_Connector("rirecommendationsshared"),

@flanakin flanakin removed the Status: 🕵️‍♀️ Investigating Issue is actively being investigated label Feb 5, 2024
flanakin added a commit that referenced this issue Feb 5, 2024
Fixes #493

1. x_BilledCostInUsd error (CostInUsd not found)
2. x_BilledPricingCost error (CostInPricingCurrency not found)
3. Actual/amortized cost columns were not merged (resulted in "__NEW_" columns)
4. __NEW_ResourceGroupName column shouldn't be there
5. Handle "tags" and "Tags" in MCA data (rename Tags to Tags2)
6. Change ChargeSubcategory "Other" for usage to "On-Demand"
7. x_SkuTerm error due to MCA values being different from EA
@flanakin
Copy link
Collaborator

flanakin commented Feb 5, 2024

For anyone who needs this before the 0.2.1 release, you can download the latest from the dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: 📦 Pending release Issue will be included in the next release Tool: Power BI Power BI reports Type: Bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants