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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Berl21
Helper III
Helper III

Calculation revenue for the last date

Hi,

I am a bit lost concerning the use of MAX with dates. I thought it would be possible to use a dynamic max date and then combine it with a calculate revenue function. 

Here is my issue:

Berl21_0-1661940932005.png

I need a measure that takes into account only the freshest date in my data set. So in this case, for project release it needs to return only the revenue for the 2nd of December 2020. But filtering my revenue with the max date delivers an error. 

I am still new at DAX and getting confused by all the possibilities. How should I approach this?

 

Thanks!

Pauline.



1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Berl21 

I made a sample file with the solution, please check the attached file,
The measure [Total Units by Max Date ] should work for you

Total Unitd by Max Date = 

IF(
    ISINSCOPE('financials'[Date]),
    VAR __MAXDATE = CALCULATE( MAX('financials'[Date]) , ALLSELECTED(financials[Date] ))
    RETURN
    IF( MAX('financials'[Date]) = __MAXDATE , [Total Units] ),
    [Total Units]
)

Fowmy_0-1661942660528.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Berl21 ,

Is your problem solved? If so, would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirment will find the solution quickly and benefit here, thank you!

 

Best Regards,
Community Support Team _ kalyj

Fowmy
Super User
Super User

@Berl21 

I made a sample file with the solution, please check the attached file,
The measure [Total Units by Max Date ] should work for you

Total Unitd by Max Date = 

IF(
    ISINSCOPE('financials'[Date]),
    VAR __MAXDATE = CALCULATE( MAX('financials'[Date]) , ALLSELECTED(financials[Date] ))
    RETURN
    IF( MAX('financials'[Date]) = __MAXDATE , [Total Units] ),
    [Total Units]
)

Fowmy_0-1661942660528.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors