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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
krishnavzm
Frequent Visitor

How to display total cost value based on two date values

Hi, I'm new to Power BI. Trying to create a report based on the data available from 2020- 2023. Please find the beow sample data.

Item code   Dispatch date  Estimated Cost  Arrival Date  Actual Cost 
I-0017/1/20221008/1/2022200
I-0027/4/20222008/4/2022300
I-0038/23/20223009/3/2022400
I-0048/24/20224009/20/2022500
I-0059/1/20225009/9/2022600
I-0069/2/202260010/2/2022700

 

From the above table , can you help me to generate chart on monthly basis. 1.Need to Display Total Actual cost / Monthly and 2. Total Estimated cost / Monthly . End User will select Year and Month as a filter option. Both 1 and 2 should be in same chart.

 

Thank you for your help

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @krishnavzm 

 

You can try the following methods. Divide your sample data into 2 tables.

Table1:

vzhangti_0-1666771929364.png

Table2:

vzhangti_1-1666771951205.png

New Table:

Date = CALENDAR(MIN('Table 1'[Dispatch Date]),MAX('Table 2'[Arrival Date]))

Column:

Year = YEAR([Date])
Month = MONTH([Date])

vzhangti_2-1666772024033.png

Measure:

Total Actual cost / Monthly =
CALCULATE (
    SUM ( 'Table 2'[Actual Cost] ),
    FILTER (
        ALL ( 'Date' ),
        [Year] = SELECTEDVALUE ( 'Date'[Year] )
            && [Month] = SELECTEDVALUE ( 'Date'[Month] )
    )
)
Total Estimated cost / Monthly =
CALCULATE (
    SUM ( 'Table 1'[Estimated Cost] ),
    FILTER (
        ALL ( 'Date' ),
        [Year] = SELECTEDVALUE ( 'Date'[Year] )
            && [Month] = SELECTEDVALUE ( 'Date'[Month] )
    )
)

Result:

vzhangti_3-1666772144670.png

vzhangti_4-1666772164299.png

Is this the result you expect?

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @krishnavzm 

 

You can try the following methods. Divide your sample data into 2 tables.

Table1:

vzhangti_0-1666771929364.png

Table2:

vzhangti_1-1666771951205.png

New Table:

Date = CALENDAR(MIN('Table 1'[Dispatch Date]),MAX('Table 2'[Arrival Date]))

Column:

Year = YEAR([Date])
Month = MONTH([Date])

vzhangti_2-1666772024033.png

Measure:

Total Actual cost / Monthly =
CALCULATE (
    SUM ( 'Table 2'[Actual Cost] ),
    FILTER (
        ALL ( 'Date' ),
        [Year] = SELECTEDVALUE ( 'Date'[Year] )
            && [Month] = SELECTEDVALUE ( 'Date'[Month] )
    )
)
Total Estimated cost / Monthly =
CALCULATE (
    SUM ( 'Table 1'[Estimated Cost] ),
    FILTER (
        ALL ( 'Date' ),
        [Year] = SELECTEDVALUE ( 'Date'[Year] )
            && [Month] = SELECTEDVALUE ( 'Date'[Month] )
    )
)

Result:

vzhangti_3-1666772144670.png

vzhangti_4-1666772164299.png

Is this the result you expect?

Best Regards,

Community Support Team _Charlotte

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

Thanks for the help. I got an idea now. Will work on the actual model

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.