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
Birinder
Helper III
Helper III

How to create a dummy table ?

Hi there,
My query is very simple.

Suppose, We have 3 different data tables, which are related to each other.
Now I want to show each column from a different data source in a new dummy table.
Like, 3 column table, in which, each column is extracted from a different data table.

TABLE 1

IDProduct
1Household
2Outdoor

 

TABLE 2

DateProduct
1-1-2021Household
2-12-2021Outdoor

 

TABLE 3

DatePrice
1-1-20211000
2-12-20212000


MY DESIRED TABLE

DateProductPrice 
1-1-2021Household1000 
2-12-2021Outdoor2000


Please note that I want to use this as a code, when creating a new table in data model.
Thanks in Advance.

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Birinder ,

 

Based on my test, we could not use DAX to create calculated column and calculated table when using Live connetion mode:

Eyelyn9_0-1640833980178.png

 

If the original relationship is as below:

Eyelyn9_1-1640834272352.png

You could directly drag fields to Table visual:

Eyelyn9_2-1640834323996.png

 

 

Or please create a measure instead:

 

Measure = CALCULATE(SUM('TABLE 3'[Price]),FILTER('TABLE 3',[Date]=MAX('TABLE 2'[Date])))

 

Eyelyn9_3-1640834421987.png

 

 

Best Regards,
Eyelyn Qin
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

7 REPLIES 7
Anonymous
Not applicable

Hi @Birinder , this is my method to achieve the result table:

 

ADDCOLUMNS(Table01, "Date", LOOKUPVALUE(Table02[Date], Table02[Products], Table01[Product]))

 

This will achieve a table as below:

jgsia_0-1640837074531.png

 

After that use "New Column" to add in te Price.

 

CALCULATE(SUM(Table03[Price]), FILTER(Table03, Table03[Date] = 'Union'[Date]))

 

Thank you.

v-eqin-msft
Community Support
Community Support

Hi @Birinder ,

 

Based on my test, we could not use DAX to create calculated column and calculated table when using Live connetion mode:

Eyelyn9_0-1640833980178.png

 

If the original relationship is as below:

Eyelyn9_1-1640834272352.png

You could directly drag fields to Table visual:

Eyelyn9_2-1640834323996.png

 

 

Or please create a measure instead:

 

Measure = CALCULATE(SUM('TABLE 3'[Price]),FILTER('TABLE 3',[Date]=MAX('TABLE 2'[Date])))

 

Eyelyn9_3-1640834421987.png

 

 

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

amitchandak
Super User
Super User

@Birinder , Merge in power query can help for that.

Merge 1 and 2 based on date and again merge table 3 based on date

 

Merge Tables (Power Query) : https://www.youtube.com/watch?v=zNrmbagO0Oo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=16

Hi @amitchandak 
I know about Power query.
But I want to do it in DAX.
Like when we write a code to add a table in model frame.
What actually I am supposed to write in there.
Sorry for such a twisted question.

@Birinder , One way is to join tables 1 and 2 on product and then join and 2 and 3 date and put the required columns in visual

 

Or you can use natural left join https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

 

I guess you still dont get it. No worries. I will explain as best as I can.

The data is live connected.It is live, so nothing appears in power query. I know I can join on table and product. But for that I need Power query. I don't want to use power query.

Birinder_1-1640593421229.png

 

Birinder_0-1640593386249.png
What to write here. Like we do function, "SELECTCOLUMNS" and input parameters to get a new desired table.
I want something like this.
Is this possible ?

 






@Birinder , if you are able to create DAX table then NATURALLEFTOUTERJOIN and NATURALINNERJOIN are DAX functions. for which I shared link https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

 

Sorry for confusion

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.