Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I'm using a tabl with items.
For demonstration reasons we copied item codes and added "-demo".
The value of demo item is 0 for accounting reasons, so the cost price is €0. But the product itself does have a value.
For example item 10.143 has a cost price of € 2700 (code and costprice column in the table).
I would like to add a custom column which generates the costprice for 10.143-demo.
My idea is to create a lookup for items with demo in the code.
In that case item 10.143-demo suppost to get the cost price of item 10.143.
Solved! Go to Solution.
Hi @Oomsen ,
You can create a calculated column as below, please find the details in the attachment.
Column =
VAR _position =
IFERROR ( SEARCH ( "-Demo", 'Table'[code], 1, 0 ), 0 )
VAR _curcode = 'Table'[code]
RETURN
IF (
_position = 0,
'Table'[costpricestandard],
CALCULATE (
MAX ( 'Table'[costpricestandard] ),
FILTER ( ALL ( 'Table' ), LEFT ( _curcode, _position - 1 ) = 'Table'[code] )
)
)
Best Regards
Hi @Oomsen ,
You can create a calculated column as below, please find the details in the attachment.
Column =
VAR _position =
IFERROR ( SEARCH ( "-Demo", 'Table'[code], 1, 0 ), 0 )
VAR _curcode = 'Table'[code]
RETURN
IF (
_position = 0,
'Table'[costpricestandard],
CALCULATE (
MAX ( 'Table'[costpricestandard] ),
FILTER ( ALL ( 'Table' ), LEFT ( _curcode, _position - 1 ) = 'Table'[code] )
)
)
Best Regards
Thanks, this is perfect!
@Oomsen , Not very clear
You can append and create in DAX and you need convert Number to text in case of power Query
Power query
"Demo-" & Number.ToText([Cost])
The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.
@amitchandak see the example below.
I would like to get the 2700 for12.042-demo in a new column.
| code | costpricestandard | description | enddate | id | isondemanditem | ispurchaseitem | issalesitem | isserialitem | isstockitem | itemgroupcode | itemgroupdescription | startdate | stock |
| 12.042-Demo | 0 | Left drive 70Vdc PU-air tires assembly | null | 4C493AE1-EAA2-4464-AA0F-3D581FF152E3 | 0 | FALSE | TRUE | FALSE | TRUE | DE | Demo Robots | 01/10/2020 00:00:00 | 1 |
| 12.042 | 2700 | Left drive 70Vdc PU-air tires assembly | null | B802F624-B442-4B3E-8D05-43B38F7ABA6C | 1 | FALSE | TRUE | FALSE | TRUE | AS | Assemblies | 01/11/2014 00:00:00 | 0 |
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |