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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
CoTheiss
Frequent Visitor

Data Mapping based on other table's field name

Hi Community ! 

As my BI-experiences are more with other tools than PowerBI, I am struggling on this one as I think it should work somehow:

 

I do have two tables:

Data

DataID Column2 Column3 Column4
1Text123<null>Text789
2<null>Text456Text789

 

Scoring

ScoringID DataColumn Score
1Column210
2Column35
3Column420

 

My issue:

I want to apply a scoring for DataQuality for one of my tables.

Meaning: I have a defined Scoring table applying a score per specific column that should be applied if the datafield is not null.

Based on the example posted, DataID 1 will have a score of 30, while DataID 2 should have a scoring of 25.

So I at least think, that I need something like

if(Data.ColumnName() = [Scoring].[DataColumn], if(isnull([Data].[Column2]),0,1)*[Scoring].[DataColumn])  

 

However, I am stuck due to the lack of PowerBI knowledge as I do not know where exactly to apply and as well how to get this comparision with the field name.

 

Hope someone can help me out here 🙂

Also, if there are any other or built-in options to do this - very appreciated!

1 ACCEPTED SOLUTION
PawarNovil
Frequent Visitor

Hello @CoTheiss 

 

You can create a calculated column  in your Data Table as

Score =
IF('DataID'[Column1]=BLANK(),0,CALCULATE(sum(Score[Score]),FILTER(Score,Score[Datacolumn]="column1")))+         IF('DataID'[Column2]=BLANK(),0,CALCULATE(sum(Score[Score]),FILTER(Score,Score[Datacolumn]="column2")))+
      IF('DataID'[Column3]=BLANK(),0,CALCULATE(sum(Score[Score]),FILTER(Score,Score[Datacolumn]="column3")))
 

PawarNovil_0-1667993006188.png

--------------------------------------------------------------------------------------------------

Also you can achive this by unpivoting Data table col1, col2, col3 in advance editor.

PawarNovil_3-1667993962809.png

 

After that you need to merge data table and score table on column "Datacolumn". 

PawarNovil_1-1667993746912.png

After merging your Data table look like this, then you can aggregate the data or create measure to get your desired result.

PawarNovil_2-1667993835564.png

 

Regards,

Novil

If I answer your question, please mark my post as a solution.

 

View solution in original post

3 REPLIES 3
PawarNovil
Frequent Visitor

Hello @CoTheiss 

 

You can create a calculated column  in your Data Table as

Score =
IF('DataID'[Column1]=BLANK(),0,CALCULATE(sum(Score[Score]),FILTER(Score,Score[Datacolumn]="column1")))+         IF('DataID'[Column2]=BLANK(),0,CALCULATE(sum(Score[Score]),FILTER(Score,Score[Datacolumn]="column2")))+
      IF('DataID'[Column3]=BLANK(),0,CALCULATE(sum(Score[Score]),FILTER(Score,Score[Datacolumn]="column3")))
 

PawarNovil_0-1667993006188.png

--------------------------------------------------------------------------------------------------

Also you can achive this by unpivoting Data table col1, col2, col3 in advance editor.

PawarNovil_3-1667993962809.png

 

After that you need to merge data table and score table on column "Datacolumn". 

PawarNovil_1-1667993746912.png

After merging your Data table look like this, then you can aggregate the data or create measure to get your desired result.

PawarNovil_2-1667993835564.png

 

Regards,

Novil

If I answer your question, please mark my post as a solution.

 

Hi @PawarNovil 

I just tried the first approach with the calculated column and it works! 

 

I also learned, that having a datafield with len(Field)=0 does not neccessarily equals blank() - as I needed to adapt the formula to if('Data'[Column2]="",...) 

 

I did not try the second approach (yet) as the first one was sufficient already (and my dataset is quite wide and long) 

BeaBF
Memorable Member
Memorable Member

@CoTheiss Looks to me like this is only possible when you transpose Table Data:

BeaBF_0-1667991372250.png

using DataColumn as key between Data Table and Scoring Table.

 

BBF

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.