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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jaweher899
Impactful Individual
Impactful Individual

Get column names and add a new measure

I've a table %apping between originator and column names in fact sales:

 

OriginatorColumnNames
EFYCF_EFY
SHCF_SH
NS 
ZKCF_ZK

 

and a table Factsales 

 

OriginatorClient_NameCF_ZKCF_SHCF_GOSCF_EFYOrigination Credit USD
EFYaaa20  40$1073
SHbbb13.3340 20$4451
NSvvv6.6780  $1798
NSccccc6.6780  $1798
ZKxxx6.6780  $719
ZKvgrgtg6.6780  $899

 

I need to add a new measure: Check the corresponding columnnames for EFY in the table maapin: the result is CF_EFY, then CF_EFY* Origination Credit USD

 

jaweher899_0-1671020458995.png

Any help please?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @jaweher899 ,

 

Here are the steps you can follow:

1. Power Query – Copy the table Factsales to form Factsale_Copy.

vyangliumsft_5-1671068642107.png

2. Check the following 5 columns – Transform – Replace Values.

Null - 0

vyangliumsft_6-1671068642112.png

3. Select the following 5 columns – Transform – Unpivot Colums.

vyangliumsft_7-1671068642115.png

Change the data format to Decimal Number.

vyangliumsft_8-1671068642116.png

4. Create measure.

Flag1 =
MAXX(FILTER(ALLSELECTED('Table'),'Table'[Originator] in SELECTCOLUMNS('Factsales',"1",[Originator])
),[ColumnNames])
Flag2 =
var _column=SELECTCOLUMNS('Factsales',"1",[Originator])
var _column2=SELECTCOLUMNS('Factsales',"2",[Client_Name])
var _sum1=SUMX(
    FILTER(ALL('Factsales_Copy'),
    'Factsales_Copy'[Originator] in SELECTCOLUMNS('Factsales',"1",[Originator])&&'Factsales_Copy'[Attribute] = [Flag1]
    && 'Factsales_Copy'[Client_Name]= MAX('Factsales'[Client_Name]))
    ,[Value])
return
_sum1
*
SUMX(FILTER(ALL(Factsales),'Factsales'[Originator]=MAX('Factsales'[Originator])&&'Factsales'[Client_Name]=MAX('Factsales'[Client_Name])),[Origination Credit USD])

5. Result:

vyangliumsft_9-1671068642117.png

 

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @jaweher899 ,

 

Here are the steps you can follow:

1. Power Query – Copy the table Factsales to form Factsale_Copy.

vyangliumsft_5-1671068642107.png

2. Check the following 5 columns – Transform – Replace Values.

Null - 0

vyangliumsft_6-1671068642112.png

3. Select the following 5 columns – Transform – Unpivot Colums.

vyangliumsft_7-1671068642115.png

Change the data format to Decimal Number.

vyangliumsft_8-1671068642116.png

4. Create measure.

Flag1 =
MAXX(FILTER(ALLSELECTED('Table'),'Table'[Originator] in SELECTCOLUMNS('Factsales',"1",[Originator])
),[ColumnNames])
Flag2 =
var _column=SELECTCOLUMNS('Factsales',"1",[Originator])
var _column2=SELECTCOLUMNS('Factsales',"2",[Client_Name])
var _sum1=SUMX(
    FILTER(ALL('Factsales_Copy'),
    'Factsales_Copy'[Originator] in SELECTCOLUMNS('Factsales',"1",[Originator])&&'Factsales_Copy'[Attribute] = [Flag1]
    && 'Factsales_Copy'[Client_Name]= MAX('Factsales'[Client_Name]))
    ,[Value])
return
_sum1
*
SUMX(FILTER(ALL(Factsales),'Factsales'[Originator]=MAX('Factsales'[Originator])&&'Factsales'[Client_Name]=MAX('Factsales'[Client_Name])),[Origination Credit USD])

5. Result:

vyangliumsft_9-1671068642117.png

 

Best Regards,

Liu Yang

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

Hi @Anonymous , I 've an issue with the total with the same report 

 

jaweher899_0-1671561031292.png

I post a new question here https://community.powerbi.com/t5/Desktop/wrong-total/td-p/2979800

 

Thank you

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors