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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Calculate sum if two dates are different

Hi

 

I have a revenue which has two dates: dateExib and dateFact I want to sum(revenue) only if dateFact is different from dateExib. Do you know how can I do it?

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Assume we have a table like below:

PBIDesktop_Elm5NlPQPZ.png

Then we can use the following DAX query:

revenuesum = CALCULATE(SUM(Table1[revenue]),FILTER(ALL(Table1),Table1[dateExib] <> Table1[dateFact]))

Best Regards,

Teige

View solution in original post

4 REPLIES 4
ntaylo06
Resolver II
Resolver II

The logic for "only if dateFact is different from dateExib" is:

IF('Table'[dateFact] <> 'Table'[dateExib], "Do something if true", "Do something if false")

But the second and third arguements depend on where you are putting the logic. Is this going to be a column in a table? Or will it be a measure?

 

Another way to ask this question is when you say "sum(revenue)" what revenue(s) do you mean?

 

evandrocunico
Resolver III
Resolver III

Hi, try to create e measure 

revenue = calculate(sum(revenue);dateFact <> dateExib)

 

Regards.

Anonymous
Not applicable

That sintaxe is not possible..-it was the first thing that I did by the way. Anyway I already solve that.

Hi @Anonymous ,

Assume we have a table like below:

PBIDesktop_Elm5NlPQPZ.png

Then we can use the following DAX query:

revenuesum = CALCULATE(SUM(Table1[revenue]),FILTER(ALL(Table1),Table1[dateExib] <> Table1[dateFact]))

Best Regards,

Teige

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.