cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Ghuiles
Advocate IV
Advocate IV

Multiple concatenated columns - Best practice

Dear Community,

 

I have a table about the Sales Order Changes. In order to have the proper Distinct Counts i would need the key columns a below.

 

CountrySales OrderSales Order DetailSales Order SequenceValueKey Sales OrderKey Sales Order Seq
A11341210A-11-34A-11-34-12
Baz122215B-az-12B-az-12-22

 

This table when in production will have millions of rows.

I am afraid that these "key" columns will consume quite some space.

Is there a best practice here? Could one column somehow be enough (Key Sales Order Seq), but then how to make the distinct count at Order Detail level??

 

Additionaly, does it play a role if i add these columns via DAX or M?

 

Cheers. G.

1 ACCEPTED SOLUTION

Hi @Ghuiles ,

Yes, I think it should suitable for your requirement. For extract original fields values, you can refer to following dax formula:

Test = PATHITEM(SUBSTITUTE([Column],"-","|"),1)

Notice: Bold part is position of merged string, you can modify to different number to extract correspond fields value.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @Ghuiles ,

You can consider to add new column to store merged key values in query editor side, then remove original fields to reduce data structure complexity.

For original key fields, you can simply extract them based on separator.

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi!

 

So, if i correctly understood, you are proposing:

- to create a column with the most detailed key i need. In the example then A-11-34-12

- if possible remove the columns that were base for that key

- if i need only a part of the key, e.g. the first 3 postions, then extract it in DAX

For example with a formula like calculate(distinctcount(mid(...

 

I am right?

Best regards. G.

Hi @Ghuiles ,

Yes, I think it should suitable for your requirement. For extract original fields values, you can refer to following dax formula:

Test = PATHITEM(SUBSTITUTE([Column],"-","|"),1)

Notice: Bold part is position of merged string, you can modify to different number to extract correspond fields value.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks @v-shex-msft !

I will try it in my next project.

Cheers. G

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors