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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Charlie_Brown
New Member

Replace Blank Value in a Matrix with Related Value from another table

Dear Community,

 

I have built a matrix to compare PRICES of a list of ITEMS from REFERENCE PRICELIST with CONTRACT PRICELIST. My challenge is that if the ITEM does not exist in CONTRACT PRICELIST, the matrix cell is blank and I would like to replace the blank with the PRICE from REFERENCE PRICE .

 

The painful way to fix it, was to insert manually rows in the CONTRACT PRICELISTs in excel for all missing ITEMS with blank PRICE , and then replace the blank with an IF function in BI:

CORRECTED PRICE = IF( ISBLANK( 'CONTRACT PRICELIST'[PRICE]), RELATED( 'REFERENCE PRICELIST'[PRICE]), 'CONTRACT PRICELIST' [PRICE])

 

The above is working fine if the EXISTING CONTRACT contains a row with the Item and blank price, however does not work if the EXISTING CONTRACT file does not contain the ITEM I am searching for some the REFERENCE PRICELIST.

 

Manually entering rows in the excel files before loading them is becoming too time consuming. Is there a way to replace those blanks without inserting rows in the excel files?

 

Capture.PNG

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Charlie_Brown ,

 

Please check the following steps as below.

 

1. Create a calculated table as below and make it related to the fact table.

ITEM = VALUES('Table'[Item])

Capture.PNG

 

2. Create a measure as below.

Measure = 
VAR cal =
    SUM ( 'Table'[value] )
RETURN
    IF (
        ISBLANK ( cal ),
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER ( ALL ( 'Table' ), 'Table'[PRI] = "REFERENCE PRICELIST" ),
            VALUES ( 'ITEM'[Item] )
        ),
        cal
    )

2.PNG

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @Charlie_Brown ,

 

Please check the following steps as below.

 

1. Create a calculated table as below and make it related to the fact table.

ITEM = VALUES('Table'[Item])

Capture.PNG

 

2. Create a measure as below.

Measure = 
VAR cal =
    SUM ( 'Table'[value] )
RETURN
    IF (
        ISBLANK ( cal ),
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER ( ALL ( 'Table' ), 'Table'[PRI] = "REFERENCE PRICELIST" ),
            VALUES ( 'ITEM'[Item] )
        ),
        cal
    )

2.PNG

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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