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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MarkDengler
Frequent Visitor

Percent Change non sequential dates

I am trying to calculate (measure) on the percentage change from Filing Data over Filing date. The issue I am having is the dates are not logical, D/D or M/M to use the Prior Date functions.  When I do try I get the AUM but not specific to the Firm Name I am filtered on (over 1k firms). Ideally, I also need "if no prior date use same FirmAUM" so the % Change isn't skewed.

 

ADV.Measure.PNG

FilingDatePriorAUM =
CALCULATE(
[Firm AUM],
FILTER(
ALL('ADV FirmInfo')
, 'ADV FirmInfo'[FilingDt].[Date]
=MAX('ADV FirmInfo'[FilingDt])-1))  >>> not working 😞
ADV.Measure2.PNG
1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

Hi @MarkDengler ,
Please try this:


 

AUM Prior Filing Date =
VAR _curFDate = table[Filing Date]
VAR _calc =
    CALCULATE (
        MAX ( table[Firm AUM] ),
        table[Filing Date] < _curFDate,
        ALLEXCEPT ( table, table[FirmCRDNum] )
    )
VAR _final =
    IF ( ISBLANK ( _calc ), MAX[Firm AUM], _calc )
RETURN
    _final

 

Edited at 9:42
Let me know if you have any questions. MOCKUP PBIX Mockup 

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
lc_finance
Solution Sage
Solution Sage

Hi @MarkDengler ,

 

 

you can find my proposed solution here.

 

Here is a screenshot:

 

Image 2019-10-29 at 6.03.07 PM.png

 

And here is the formula for the AUM prior filing date:

AUM Prior filing date = 

VAR currentFirmNumber = [Firm Number]
VAR currentFirmName = [Firm name]
VAR currentFilingDate = [Filing date]

VAR priorDateTable = FILTER(
    'FirmInfo',
    AND('FirmInfo'[Firm Number]=currentFirmNumber, AND('FirmInfo'[Firm name]=currentFirmName, 'FirmInfo'[Filing date]<currentFilingDate))
)

VAR priorDateExist = NOT COUNTX(priorDateTable, [Filing date]) = BLANK()

VAR priorDate = MAXX(priorDateTable,[Filing date])

VAR priorDateAUM = LOOKUPVALUE(FirmInfo[Firm AUM],FirmInfo[Filing date],priorDate,FirmInfo[Firm name],currentFirmName)

RETURN IF(priorDateExist, priorDateAUM, [Firm AUM])

 

At first, I create a table 'priorDateTable' which includes all the dates except the current date.

Then, I check if a prior date exist (a prior date exist if the table 'priorDateTable' has at least one row)

 

Following that, I find the prior date 'priorDate', which is the maximum date in the table 'priorDateTable'.

Finally, I use a LOOKUPVALUE to find the AUM corresponding to the prior date.

 

The percentage change formula is a lot easier;

 

Percentage change = [Firm AUM]/[AUM Prior filing date]-1

 

I hope this helps you and do not hesitate if you have any questions!

 

LC

Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com

Nathaniel_C
Super User
Super User

Hi @MarkDengler ,
Please try this:


 

AUM Prior Filing Date =
VAR _curFDate = table[Filing Date]
VAR _calc =
    CALCULATE (
        MAX ( table[Firm AUM] ),
        table[Filing Date] < _curFDate,
        ALLEXCEPT ( table, table[FirmCRDNum] )
    )
VAR _final =
    IF ( ISBLANK ( _calc ), MAX[Firm AUM], _calc )
RETURN
    _final

 

Edited at 9:42
Let me know if you have any questions. MOCKUP PBIX Mockup 

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




You are a amazing; this worked beautifully.  Thank you so much! 

@MarkDengler ,

You are welcome, thanks for your kind words!

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.