Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
anusha_2023
Helper IV
Helper IV

Filled Map with inactive relationship

I am trying to visualize country column data from the Customer dimension using the filled map

anusha_2023_2-1708873582185.png

 

 

I have a slicer from CostCenter[Name] and need to reflect country data in the map. Due to the inactive relationship between Person and Customer, I am using Userelationship and writing the following measure to include the Location field for the Map instead Country column directly from the Customer dimension.

anusha_2023_1-1708873413211.png

But I am getting the following error. Please help me to rewrite the measure. The above relationships I could not change to active since I have other facts and dimensions that might lead to circular relations so I need to work with measure to be inactive only.

 

anusha_2023_0-1708873383644.png

 

8 REPLIES 8
123abc
Community Champion
Community Champion

The error you're encountering in your DAX measure likely stems from the inactive relationship between Person and Customer. Here's how you can rewrite the measure to address this issue:

 

1. Using VAR with LOOKUPVALUE:

The error you're encountering in your DAX measure likely stems from the inactive relationship between Person and Customer. Here's how you can rewrite the measure to address this issue:

 

1. Using VAR with LOOKUPVALUE:

 
Filled Map Measure = 
VAR SelectedCostCenter = SELECTEDVALUE(CostCenter[Name])
VAR CustomerTable = 
    FILTER(
        Customer,
        RELATED(Person[CostCenterName]) = SelectedCostCenter
    )
VAR Location = 
    LOOKUPVALUE(
        Customer[Location],
        Customer[CustomerID],
        RELATED(Customer[CustomerID])
    )
RETURN
    IF(
        ISBLANK(Location),
        BLANK(),
        Location
    )

Explanation:

  • We define a variable SelectedCostCenter to capture the selected value from the CostCenter slicer.
  • We filter the Customer table based on the CostCenter using RELATED(Person[CostCenterName]).
  • We use LOOKUPVALUE to find the corresponding Location for the filtered customer based on their CustomerID.
  • Finally, we return the Location if found, and BLANK otherwise.

 

2. Using CALCULATE with TREATAS:

The error you're encountering in your DAX measure likely stems from the inactive relationship between Person and Customer. Here's how you can rewrite the measure to address this issue:

1. Using VAR with LOOKUPVALUE:

Code snippet
Filled Map Measure = 
VAR SelectedCostCenter = SELECTEDVALUE(CostCenter[Name])
VAR CustomerTable = 
    FILTER(
        Customer,
        RELATED(Person[CostCenterName]) = SelectedCostCenter
    )
VAR Location = 
    LOOKUPVALUE(
        Customer[Location],
        Customer[CustomerID],
        RELATED(Customer[CustomerID])
    )
RETURN
    IF(
        ISBLANK(Location),
        BLANK(),
        Location
    )
 

Explanation:

  • We define a variable SelectedCostCenter to capture the selected value from the CostCenter slicer.
  • We filter the Customer table based on the CostCenter using RELATED(Person[CostCenterName]).
  • We use LOOKUPVALUE to find the corresponding Location for the filtered customer based on their CustomerID.
  • Finally, we return the Location if found, and BLANK otherwise.

 

2. Using CALCULATE with TREATAS:

 
Filled Map Measure = 
VAR SelectedCostCenter = SELECTEDVALUE(CostCenter[Name])
VAR ActiveCustomerTable = 
    CALCULATE(
        Customer,
        TREATAS(
            Person[CostCenterName],
            SelectedCostCenter
        )
    )
VAR Location = 
    SUMX(
        ActiveCustomerTable,
        ActiveCustomerTable[Location]
    )
RETURN
    Location

Explanation:

  • We define a variable SelectedCostCenter similar to the previous approach.
  • We use CALCULATE with TREATAS to temporarily activate the relationship between Person and Customer for the selected cost center.
  • We then use SUMX to iterate through the filtered ActiveCustomerTable and aggregate the Location values.

Both options achieve the same outcome: they filter the customer data based on the selected cost center and return the corresponding location for the map visualization. The choice between them might depend on your preference and coding style.

 

Remember:

  • These solutions work with inactive relationships, but activating relationships is generally recommended for better performance and data consistency if possible.
  • Ensure your data model is well-structured to minimize the need for workarounds like inactive relationships.

I hope this helps!

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

 

 

Thank for your reply.

https://drive.google.com/file/d/1dx8Q08o_351S_jAXavWmMPlGPVzfhkEo/view?usp=drive_link 

I have tried both measures and there are small problems could you please check the sample data and measure implementation

lbendlin
Super User
Super User

Replace VALUES with MAX

Thank you very much for your reply. Now I got only one city instead CostCenter has many customer countries how an I get all coutries when filtered from CostCenter and get Customer Countries to give as input to the Location in the filled map.

Measure Customer Country = CALCULATE(

         MAX ( Customer[Country] ),USERELATIONSHIP

(Person[Id],Customer[Id]))

Right now even though I tried to give this as input the filled map Location it is not acceptable by the visual.

Switch from USERELATIONSHIP to TREATAS

I tried to post pbix file but I could not able to find an option to attach here.To be more clear I have slicer from CostCenter on the Level field and I posted the data model and map again to be clear and I cannot change he relationships as I have other dimentions and facts which might effect.

Measure Customer Country =
CALCULATE(
    VALUES(Customer[Country]),
    REMOVEFILTERS(Person),
    KEEPFILTERS(Customer),
    USERELATIONSHIP( PersonView[ID],'MDCustomer'[Owner]
    )
)

I used above measure to rectify the issues but still getting the same error as below

anusha_2023_2-1708980586371.png

 

anusha_2023_0-1708980351673.png

anusha_2023_1-1708980388354.png

Not sure how to rectify with treatas. Please help me further if any of you can suggest any further views

Thanks for the reply. Please find the link to google drive

https://drive.google.com/file/d/1NnevayBggtZJ86QNvVl-rQUj-TSi-nFA/view?usp=drive_link

I have included sample data, measure "country" in the measure table and I tried to give measure to the map Location in the data section and it is not acceptable.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.