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
Zerozinho
New Member

How to obtain a return series?

  1. Hey all,

 

I'm facing the following problem and I'm having trouble solving it. Given the following table

 

DateBenchmarkDesired Column
03/02/20211197251,0126
02/02/20211182341,0074
01/02/20211173651,0117
29/01/20211160070,9900
28/01/20211171720,9892
27/01/20211184430,9894
26/01/20211197080,9920
22/01/20211206731,0014
21/01/20211205021

 

I want to calculate the "Desired Column" that is reached by dividing the N day by N-1 day. So for example, for the date 03/02/2021 the math would be 119725/118234 = 1,0126. Is there any DAX formula that could work in this problem? I have tried some combinations of formulas but no success. Thanks in advance

1 REPLY 1
mahoneypat
Employee
Employee

Here is a measure expression you can use in a table visual with your date and benchmark columns.

 

NewMeasure =
VAR vThisDate =
    MIN ( Benchmark[Date] )
VAR vPrevDate =
    CALCULATE (
        MAX ( Benchmark[Date] ),
        ALL ( Benchmark[Date] ),
        Benchmark[Date] < vThisDate
    )
VAR vThisBenchmark =
    SUM ( Benchmark[Benchmark] )
VAR vPrevBenchmark =
    CALCULATE (
        SUM ( Benchmark[Benchmark] ),
        ALL ( Benchmark[Date] ),
        Benchmark[Date] = vPrevDate
    )
VAR vDenominator =
    IF (
        ISBLANK ( vPrevBenchmark ),
        vThisBenchmark,
        vPrevBenchmark
    )
RETURN
    DIVIDE (
        vThisBenchmark,
        vDenominator
    )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.

Top Solution Authors