Forum Discussion

iwasti1975's avatar
iwasti1975
New Member
3 years ago

How to get minimum value comparing with last three years expenses.

I am new to this forum. I have a task to create a measure thats provide min value of each month within last three years expenses.

Currently I am getting three year min value with out cumulative for each year but now the client requirement is to calculate Minimum by cumulative values each year.

 

My Measure:

Three Yrs Low FSCM Actual =
Var ReferenceDate = Date(Year(Now())-1,12,01)
Var PreviousDate = Date(Year(Now())-3,01,01)
Var Result =
    CALCULATE(Three Year Min
        Min(All_Dimensions_Pivot[FSCM ACTUALS]),        
        KEEPFILTERS(All_Dimensions_Pivot[Date] > PreviousDate && All_Dimensions_Pivot[Date] <= ReferenceDate
        )
       
    )
Return Result

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi iwasti1975 ,

     

    You can add a calculated column to calculate the cumulative value at the day level, and then use a similar formula to calculate the minimum value.

     

    cumulative values = CALCULATE(SUM('All_Dimensions_Pivot'[FSCM ACTUALS]),FILTER(ALL('All_Dimensions_Pivot'),'All_Dimensions_Pivot'[Date]<=EARLIER(All_Dimensions_Pivot[Date])))
    Measure = 
    VAR ReferenceDate =
        DATE ( YEAR ( NOW () ) - 1, 12, 01 )
    VAR PreviousDate =
        DATE ( YEAR ( NOW () ) - 3, 01, 01 )
    VAR Result =
        CALCULATE (
            MIN ( All_Dimensions_Pivot[cumulative values] ),
            KEEPFILTERS ( All_Dimensions_Pivot[Date] > PreviousDate
                && All_Dimensions_Pivot[Date] <= ReferenceDate )
        )
    RETURN
        Result

    Please refer to the sample file.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

  • Thanks for responding my question. When i did apply your solution it did not work and i am getting wrong value, therefore i am attaching a excel sheet with some data and desired result set. The table has many other columns like project, stage category etc. I am only considering summarized all values by program and monthly. please pay ateention date column it is only monthly values already.

     

    DateProgramFSCM ACTUALSYearly Cumulative FSCM Actual
    1/1/2021891.WTP                  89,965                           89,965
    1/1/2021892.WDN-73601416346395
    2/1/2021891.WTP             1,761,563                      1,851,528
    2/1/2021892.WDN52904716875442
    3/1/2021891.WTP             3,575,237                      5,426,765
    3/1/2021892.WDN431244421187886
    4/1/2021891.WTP                729,631                      6,156,396
    4/1/2021892.WDN3602319 
    5/1/2021891.WTP                905,395                      7,061,791
    5/1/2021892.WDN930708 
    6/1/2021891.WTP                770,141                      7,831,932
    6/1/2021892.WDN2144163 
    7/1/2021891.WTP                447,716                      8,279,648
    7/1/2021892.WDN1120797 
    8/1/2021891.WTP                282,100                      8,561,748
    8/1/2021892.WDN1195397 
    9/1/2021891.WTP                315,401                      8,877,149
    9/1/2021892.WDN1728384 
    10/1/2021891.WTP                159,402                      9,036,551
    10/1/2021892.WDN2471870 
    11/1/2021891.WTP                245,841                      9,282,392
    11/1/2021892.WDN1066562 
    12/1/2021891.WTP             1,427,079                   10,709,471
    12/1/2021892.WDN3885164 
    1/1/2022891.WTP              (220,161)                       (220,161)
    1/1/2022892.WDN-461520 
    2/1/2022891.WTP                738,104                         517,943
    2/1/2022892.WDN57288 
    3/1/2022891.WTP             1,213,675                      1,731,618
    3/1/2022892.WDN2075333 
    4/1/2022891.WTP                400,114                      2,131,732
    4/1/2022892.WDN2636699 
    5/1/2022891.WTP             1,183,071                      3,314,803
    5/1/2022892.WDN1680526 
    6/1/2022891.WTP              (445,713)                      2,869,090
    6/1/2022892.WDN779186 
    7/1/2022891.WTP             1,236,714                      4,105,804
    7/1/2022892.WDN1247430 
    8/1/2022891.WTP                635,315                      4,741,119
    8/1/2022892.WDN3704731 
    9/1/2022891.WTP             1,905,156                      6,646,275
    9/1/2022892.WDN14627970 
    10/1/2022891.WTP             1,006,790                      7,653,065
    10/1/2022892.WDN1817216 
    11/1/2022891.WTP                587,047                      8,240,112
    11/1/2022892.WDN6828367 
    12/1/2022891.WTP              (660,279)                      7,579,833
    12/1/2022892.WDN-890622 
    1/1/2023891.WTP                (57,745)                         (57,745)
    2/1/2023891.WTP                  20,236                         (37,509)
    3/1/2023891.WTP                      (341)                         (37,850)