cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
marijane12 Regular Visitor
Regular Visitor

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

Accepted Solutions
Community Support Team
Community Support Team

Re: Calculate sum if two dates are different

Hi @marijane12 ,

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

Re: Calculate sum if two dates are different

Hi, try to create e measure 

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

 

Regards.

ntaylo06 Regular Visitor
Regular Visitor

Re: Calculate sum if two dates are different

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?

 

marijane12 Regular Visitor
Regular Visitor

Re: Calculate sum if two dates are different

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

Community Support Team
Community Support Team

Re: Calculate sum if two dates are different

Hi @marijane12 ,

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

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)