FlexReport Error: Query Contains Ambiguous Columns
search cancel

FlexReport Error: Query Contains Ambiguous Columns

book

Article ID: 435504

calendar_today

Updated On:

Products

CloudHealth

Issue/Introduction

Users, when creating or editing a FlexReport in CloudHealth, may encounter an error stating:

Query contains ambiguous columns. Please use Alias on the dataset and reference the alias on columns used from datasets in the Query.”
"Example: Select <<Alias>>.<<ColumnName1>>, <<Alias>>.<<>ColumnName2>> from <<Dataset>> as <<Alias>>"


This issue arises when "Enable backlinking" is disabled (switch is off) on the FlexReport >> Dimensions panel

Environment

CloudHealth
Flex Reports
Query
Tags
Backlinking 

Cause

This is expected behavior.  
In early 2026 CloudHealth updated the internal data representation used in Flex Reporting.  
Before this update when Tag Backlinking was disabled, all tag value changes within a month were displayed in query results.
After the update only the latest tag value for each month is retained. Any tag modifications that occurred within the same month will not be visible in historical data.  
No behavior changes when Tag Backlinking is enabled

Resolution

  1. When tags are used in a FlexReport and tag backlinking is disabled, it is required to alias the dataset and reference this alias explicitly while selecting columns in the query. This ensures that the query engine can correctly identify the source of each column and avoids ambiguity errors.   See below examples.


  2. If tag backlinking has been disabled unintentionally or is not needed then please re-enable it to resolve the error message.



    Example Flex Query

    //  Unmodified example query
    {
    "sqlStatement" : 
     " SELECT
    	timeInterval_Month AS timeInterval_Month,
    	ELEMENT_AT (
    		\"billingTags##CostCategoryTags\",
    		'costcategory/cht_tower'
    	) AS billingTags_CostCategoryTags_costcategory_cht_tower,
    	ELEMENT_AT (
    		\"billingTags##tags_as_map\",
    		'resourcetags/user:cht_owner'
    	) AS billingTags_tags_as_map_resourcetags_user_cht_owner
    FROM
    	AWS_CUR
    GROUP BY
    	timeInterval_Month,
    	ELEMENT_AT (
    		\"billingTags##CostCategoryTags\",
    		'costcategory/cht_tower'
    	),
    	ELEMENT_AT (
    		\"billingTags##tags_as_map\",
    		'resourcetags/user:cht_owner'
    	) ",
    
    "needBackLinkingForTags" : false ,
    "dataGranularity" : "MONTHLY" ,
    "timeRange" : {
      "last": 3
    } ,
    "limit" : -1
    }

     

// Example with dataset alias.  
// Alias awsCur is created for AWS_CUR and the SELECT and GROUP BY clauses use the alias

{
"sqlStatement" : 
 " SELECT
	awsCur.timeInterval_Month AS timeInterval_Month,
	ELEMENT_AT (
		\"billingTags##CostCategoryTags\",
		'costcategory/cht_tower'
	) AS billingTags_CostCategoryTags_costcategory_cht_tower,
	ELEMENT_AT (
		\"billingTags##tags_as_map\",
		'resourcetags/user:cht_owner'
	) AS billingTags_tags_as_map_resourcetags_user_cht_owner
FROM
	AWS_CUR AS awsCur
GROUP BY
	awsCur.timeInterval_Month,
	ELEMENT_AT (
		\"billingTags##CostCategoryTags\",
		'costcategory/cht_tower'
	),
	ELEMENT_AT (
		\"billingTags##tags_as_map\",
		'resourcetags/user:cht_owner'
	) ",

"needBackLinkingForTags" : false ,
"dataGranularity" : "MONTHLY" ,
"timeRange" : {
  "last": 3
} ,
"limit" : -1
}

 

Additional Information

Previously, when Tag Backlinking was disabled, all tag value changes within a month were displayed in query results
Currently, only the latest tag value for each month is retained. Any tag modifications that occurred within the same month will not be visible in historical data