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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
miemer
Regular Visitor

InOut report

Hi everyone, I'm new to power bi even though I've built several reports for work. Now I have this problem: I would like to build a table in which the first column is the date while the second column is populated by taking values ​​from two tables (sql and Filemaker via odbc). The data from sql are negative, the consumption of a raw material while the data from Filemaker are the income of that matter (positive values). I would like to represent the entire progression of consumption by showing the trend to understand if I will have problems before the expected date of receipt of the goods...

 

Thanks

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

Hi  @miemer ,

Sumx returns the sum of the expressions evaluated for each row in the table.

You can also use these methods to achieve the desired effect:

According to your description, I create this data:

Table Filemaker:

v-yangliu-msft_0-1615270376340.png

Table SQL:

v-yangliu-msft_1-1615270376344.png

Here are the steps you can follow:

Associate the three tables with the date column:

v-yangliu-msft_2-1615270376346.png

 

The first method:

Create calculated column.

trend_way1 =
var _sql=CALCULATE(SUM('SQL'[Consumption of raw materials]),FILTER('SQL','SQL'[date]=EARLIER('Table'[date])))
var _File=CALCULATE(SUM('Filemaker'[Material income]),FILTER('Filemaker','Filemaker'[date]=EARLIER('Table'[date])))
return
_sql+_File

The second method:

Create calculated column.

trend_way2 = RELATED(Filemaker[Material income])+RELATED('SQL'[Consumption of raw materials])

Result:

v-yangliu-msft_3-1615270376348.png

Finally put it into the line chart for display

v-yangliu-msft_4-1615270376358.png

You can downloaded PBIX file from here.

 

Here is the link of the Dax function, I hope it will help you:

https://docs.microsoft.com/en-us/dax/related-function-dax

https://docs.microsoft.com/en-us/dax/sumx-function-dax

 

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

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @miemer ,

Sumx returns the sum of the expressions evaluated for each row in the table.

You can also use these methods to achieve the desired effect:

According to your description, I create this data:

Table Filemaker:

v-yangliu-msft_0-1615270376340.png

Table SQL:

v-yangliu-msft_1-1615270376344.png

Here are the steps you can follow:

Associate the three tables with the date column:

v-yangliu-msft_2-1615270376346.png

 

The first method:

Create calculated column.

trend_way1 =
var _sql=CALCULATE(SUM('SQL'[Consumption of raw materials]),FILTER('SQL','SQL'[date]=EARLIER('Table'[date])))
var _File=CALCULATE(SUM('Filemaker'[Material income]),FILTER('Filemaker','Filemaker'[date]=EARLIER('Table'[date])))
return
_sql+_File

The second method:

Create calculated column.

trend_way2 = RELATED(Filemaker[Material income])+RELATED('SQL'[Consumption of raw materials])

Result:

v-yangliu-msft_3-1615270376348.png

Finally put it into the line chart for display

v-yangliu-msft_4-1615270376358.png

You can downloaded PBIX file from here.

 

Here is the link of the Dax function, I hope it will help you:

https://docs.microsoft.com/en-us/dax/related-function-dax

https://docs.microsoft.com/en-us/dax/sumx-function-dax

 

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.

AllisonKennedy
Super User
Super User

I would say you'll need three tables in your PBI data model: DimDate, SQL and Filemaker

Relate the SQL and Filemaker to DimDate using Date or DateKey columns. 

https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

 

Then you can create a table visualization with DimDate[Date] as the first column. Create a measure for the second column. New MEASURE:

StockOnHand= SUMX(DimDate, CALCULATE(SUM(SQL[Consumption])) + CALCULATE(SUM(Filemaker[Income])) )

 

Then use this in a line chart and use the forecast analytics to see trends. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Thanks for the valuable reply, I will try the proposed solution as soon as possible. To take advantage: The SUMX function will retrieve the values ​​from the two tables (sql and filemaker) according to the date in the first column, correct?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.