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
jiinson
Helper I
Helper I

Combining data in two tables and creating clustered column table

Hi

 

I have two tables contatining Invoice amount and Order Amount.

 

table 1)

invoice date, invoice amount($)

 

table 2)

order date, order amount($)

 

I want to create the graph looks like

unnamed.jpg

 

I know how to set up the measures of prior year and current year for each invoice values and order values. I want to know how to set up x-axis with invoice and order. I have a date table linked with invoice date and order date.

 

Regards,

Jiin

2 ACCEPTED SOLUTIONS
Phil_Seamark
Employee
Employee

Hi @jiinson

 

See if you can combine the two tables into 1.  The Query Editor is probably the better place to do this, but it can be done in DAX.

 

I suggest the format of your combined table should be three columns

 

 

Date ,        Type ,    Amount
------------------------------
2017-01-01 , 'Invoice' , 100
2017-02-01 , 'Order'   , 200

Then when you have the data in a single table, you'll need to create two calcluated measures.  The first will simply be the sum of the Amount column.

 

The 2nd measure will be similar to the first but take advantage of one of the Time-intelligence functions in DAX such as SAMEPERIODLASTYEAR or PARALLELPERIOD etc.  www.daxpatterns.com is a great website for tips on the best patterns.

 

Then just drag Type to the Axis, and your two measures to the Values area of your visual.

 

If you need help with the DAX, let us know and we can help build that.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

v-huizhn-msft
Employee
Employee

Hi @jiinson,

As I tested, you can combine the tables to one as the following steps.

Create a type calculated column in each table.

Type = "invoice"

Type = "order"


1.PNG2.PNG

Then please click "New Table" under Modeling on home page. You can get a new table like the screenshot below.

Table = UNION(Table1,Table2)


3.png


Finally, create a current and last year measure based on the new table, and select the Type to the Axis, and your two measures to the Values area of your visual as @Phil_Seamark posted.

Please let me know if you have any question.

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

Hi @jiinson,

As I tested, you can combine the tables to one as the following steps.

Create a type calculated column in each table.

Type = "invoice"

Type = "order"


1.PNG2.PNG

Then please click "New Table" under Modeling on home page. You can get a new table like the screenshot below.

Table = UNION(Table1,Table2)


3.png


Finally, create a current and last year measure based on the new table, and select the Type to the Axis, and your two measures to the Values area of your visual as @Phil_Seamark posted.

Please let me know if you have any question.

Best Regards,
Angelia

Phil_Seamark
Employee
Employee

Hi @jiinson

 

See if you can combine the two tables into 1.  The Query Editor is probably the better place to do this, but it can be done in DAX.

 

I suggest the format of your combined table should be three columns

 

 

Date ,        Type ,    Amount
------------------------------
2017-01-01 , 'Invoice' , 100
2017-02-01 , 'Order'   , 200

Then when you have the data in a single table, you'll need to create two calcluated measures.  The first will simply be the sum of the Amount column.

 

The 2nd measure will be similar to the first but take advantage of one of the Time-intelligence functions in DAX such as SAMEPERIODLASTYEAR or PARALLELPERIOD etc.  www.daxpatterns.com is a great website for tips on the best patterns.

 

Then just drag Type to the Axis, and your two measures to the Values area of your visual.

 

If you need help with the DAX, let us know and we can help build that.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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.