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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
CarlosOlmos29
Helper I
Helper I

Add two measures after a date

Hello Power BI Community.

I am trying to sum two DAX measures, but I need them to be summed only after a certain date (after the line in the image). I tried with an if but it didn't work. I would appreciate if you can give me some ideas to solve this problem.

The measures are SUM OIL REAL(BLS) and FCST OIL.

Thanks in advance for your support.

CarlosOlmos29_0-1714402824512.png

 

7 REPLIES 7
v-yilong-msft
Community Support
Community Support

Hi @CarlosOlmos29 ,

I create a table and two measures as you mentioned.

vyilongmsft_0-1714446461085.png

Then I create a measure and here is the DAX code.

 

Measure = 
CALCULATE (
    'Table'[Measure1] + 'Table'[Measure2],
    FILTER ( 'Table', 'Table'[Date] > DATE ( 2024, 1, 2 ) )
)

 

vyilongmsft_1-1714446578994.png

 

 

 

Best Regards

Yilong Zhou

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

Tahreem24
Super User
Super User

@CarlosOlmos29 You can use the below measure to achieve your result, in my case I took the date after 2-Jan-2024, likewise you can write your expected date value.

Measure = CALCULATE(SUM('Table'[Value1])+SUM('Table'[Value2]),FILTER('Table','Table'[Date]>DATE(2024,1,2)))

 

Tahreem24_0-1714405104446.png

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

It worked with the date, but it is not adding up the measurements. It looks like the screenshot below.

CarlosOlmos29_0-1714406038926.png

 

This is the measure I am using:

Real + fcst = CALCULATE([SUMA OIL REAL(BLS)] + [FCST OIL],FILTER(Consolidado, Consolidado[VOLUME_DATE] > MAX(Real[VOLUME_DATE])))
I think it is not adding up because the SUMA OIL REAL(BLS) data is being repeated after March 15. Actually there is no more data entered after that date. We could modify the measurement so that the last data of March 15 of SUMA OIL REAL is added with the one of April 15 of FCST OIL.
Housden996
Helper II
Helper II

I may be miss understanding but can you not just add a date filter?

How? I tried to use the next measure:

Real + fcst = CALCULATE([SUMA OIL REAL(BLS)] + [FCST OIL],Consolidado[VOLUME_DATE] >= [FechaCorte])
([FechaCorte] is the date from which I want the measurements to start adding up) 
But the measurement gives me an error

So it looks like its pulling in a list of dates try using the ISONORAFTER function:
ISONORAFTER function (DAX) - DAX | Microsoft Learn

If you can help me with the measure I would aprecciate it 🙂 I don't know how to use it in this case

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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