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
Binkhorst
Frequent Visitor

Overriding a dimension value in a calculation - old article number to new article number

I have a report that calculates the turnover per article. Some articles have been received a new article number but for reporting purposes I want to show the turnover combined with the old article. There is a dimension table with the relationship between the old and the new article number but I am trying to find the best way to use this in my calculations. 

 

Dimension table 1 : article 

Article numberArticle name
1Product 1
2Product 2
3Product 3

 

Dimension table 2: old article number new article number

Article numberNew Article number
13

 

Sales table

Article numberSales Amount
110
215
320
115
310

 

I need the Sales to show a turnover of 55 on article 3 and 0 on article 1. How do I override the existing relationship I have between the dimension table and the fact table. I would really appreciate the help.

1 ACCEPTED SOLUTION
PC2790
Community Champion
Community Champion

This is how I would do it,

Creating a new column in both Sales and Article Table whihc would have the overridden article value.

I have used LOOKUPVALUE for the same

Then creating a relation ship between these two tables base don overridden article number

and then visualise it as normal. Refer attached sample file

PC2790_0-1652248598961.png

The only downside to this is the many to many relationship that it forms that you can avoid using a bridge table.

View solution in original post

4 REPLIES 4
Binkhorst
Frequent Visitor

Thank you amitchandak, I tried your formula but I could not make this check : Dim2[Article number] = Sales[Article number] in my dax code so something seems to be missing? 

PC2790
Community Champion
Community Champion

This is how I would do it,

Creating a new column in both Sales and Article Table whihc would have the overridden article value.

I have used LOOKUPVALUE for the same

Then creating a relation ship between these two tables base don overridden article number

and then visualise it as normal. Refer attached sample file

PC2790_0-1652248598961.png

The only downside to this is the many to many relationship that it forms that you can avoid using a bridge table.

Thank you PC2790, your solution works. I was able to avoid the many to many relationship by using the function USERELATIONSHIP.

 

CAL Sales Amount = CALCULATE(
sum(SalesTable[Sales Amount] ),
USERELATIONSHIP(SalesTable[New Article Number],ArticleTable[Article number])
)
amitchandak
Super User
Super User

@Binkhorst , Create a new column in sales Table

 

New Ids =

var _1 = maxx(filter(Dim2, Dim2[Article number] = Sales[Article number]), Dim2[New Article number])

return

if(isblank(_1) , [Article number] , _1)

 

Join this with dimesion

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.