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
andreasanderzon
Regular Visitor

Combine a cost tabel with montly specified costs on daily orders

Hi,

I have a table with freight cost on different channels, for example an average freight cost on one channel is 30 EUR one month and 33 EUR antoher month. I have added the average freight cost for an order specified per month in that table (added it for all months). I have then created a relation to a Date table. On the other side we do have revenues. When I calculate the margin the freight cost is only calculated the single day per month (first day of every month) and the margin is then not correct when I look over a certain operiod in the visualization. 

 

How can I use that monthly cost to be valid for all the days on the choosed months?

 

Thanks:)

 

BR
Adreas

1 ACCEPTED SOLUTION

Hi,

First write this measure

Measure 1 = sum(freighttable2[Inkl lost])

In my measure, replace Inkl lost with Measure 1.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
andreasanderzon
Regular Visitor

Thanks for your reply, means a lot! I have been trying to work more with it. The meassure that does not work properly is:

MeasureTest = SUMX('freighttable2',[Inkl lost] *[Number orders])
 
What am I trying to do with it? I have different channels where I have different freight costs and the costs differ monthly. This is the different specific formulas : 
Number orders = DISTINCTCOUNT(Table[Sello order number])
This works correct when I choose a period and different channels

SUMX('freighttable2',[Inkl lost]

This also works correct for the selected filtered period.

 

Shaurya
Memorable Member
Memorable Member

Hi @andreasanderzon,

 

Since I do not have any sample data to refer or any measure for the calculations that you have done, what I can tell is that double check the columns that you are using for your calculations and if you added them in visuals then check the filters that are being applied. Your date slicer might be filtering the values that you need and in turn affecting your result.

 

Did I answer your question? Mark this post as a solution if I did!
Consider taking a look at my blog: Forecast Period - Previous Forecasts

Thanks for your reply, means a lot! I have been trying to work more with it. The meassure that does not work properly is:

MeasureTest = SUMX('freighttable2',[Inkl lost] *[Number orders])
 
What am I trying to do with it? I have different channels where I have different freight costs and the costs differ monthly. This is the different specific formulas : 
Number orders = DISTINCTCOUNT(Table[Sello order number])
This works correct when I choose a period and different channels

SUMX('freighttable2',[Inkl lost]

This also works correct for the selected filtered period.

 

The issue is when I use this formula:

SUMX('freighttable2',[Inkl lost] *[Number orders])

 

 

 

I guess the issue is that in the freight cost table I want to add the cost for the total month, but when I import the data from excel it calculate the cost for orders from that specific date. 

 

 Here is examle how the table with greigh costs looks like:

 

Channel 1  2022-09-30  27,08
Channel 1  2022-10-31  27,08
Channel 1  2022-11-30  27,08
Channel 1  2022-12-31  27,08
Channel 2  2022-09-30  71,725
Channel 2  2022-10-31  71,725
Channel 2  2022-11-30  71,725

 and so on..

 

I do want to have the possibility to change the freight cost on monthly basis, but how can I make this without adding every day in the table? (I have 40 different sale channels).

 

Thanks!:)

 

Hi,

Not sure of what you want but try this measure

=SUMX(generate(values(calendar[Month name]),values(calendar[year])),[Inkl lost] *[Number orders])

Ensure you have a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name column by the Month number.  Create a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table.

If this does not help, then share the download link of your PBI file. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, Thanks for your reply.

I used =SUMX(generate(values(calendar[Month name]),values(calendar[year])),[Inkl lost] *[Number orders])

, just changed the Dax vale names to match my dax table. I only got one error, the [Inkl lost] is not found since it is only a column in the tabe 'freighttable2'. How can I adapt the formula to pick up the column and not the meassue [Inkl lost]?

 

The table source:

Channel          Date              Inkl Lost

Channel 1  2022-09-30  27,08
Channel 1  2022-10-31  27,08
Channel 1  2022-11-30  27,08
Channel 1  2022-12-31  27,08
Channel 2  2022-09-30  71,725
Channel 2  2022-10-31  71,725
Channel 2  2022-11-30  71,725

Hi,

First write this measure

Measure 1 = sum(freighttable2[Inkl lost])

In my measure, replace Inkl lost with Measure 1.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.