Forum Discussion
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:
2 Replies
- AnonymousNot 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 ResultPlease refer to the sample file.
Best Regards,
Gao
Community Support TeamIf 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
- iwasti1975New Member
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.
Date Program FSCM ACTUALS Yearly Cumulative FSCM Actual 1/1/2021 891.WTP 89,965 89,965 1/1/2021 892.WDN -736014 16346395 2/1/2021 891.WTP 1,761,563 1,851,528 2/1/2021 892.WDN 529047 16875442 3/1/2021 891.WTP 3,575,237 5,426,765 3/1/2021 892.WDN 4312444 21187886 4/1/2021 891.WTP 729,631 6,156,396 4/1/2021 892.WDN 3602319 5/1/2021 891.WTP 905,395 7,061,791 5/1/2021 892.WDN 930708 6/1/2021 891.WTP 770,141 7,831,932 6/1/2021 892.WDN 2144163 7/1/2021 891.WTP 447,716 8,279,648 7/1/2021 892.WDN 1120797 8/1/2021 891.WTP 282,100 8,561,748 8/1/2021 892.WDN 1195397 9/1/2021 891.WTP 315,401 8,877,149 9/1/2021 892.WDN 1728384 10/1/2021 891.WTP 159,402 9,036,551 10/1/2021 892.WDN 2471870 11/1/2021 891.WTP 245,841 9,282,392 11/1/2021 892.WDN 1066562 12/1/2021 891.WTP 1,427,079 10,709,471 12/1/2021 892.WDN 3885164 1/1/2022 891.WTP (220,161) (220,161) 1/1/2022 892.WDN -461520 2/1/2022 891.WTP 738,104 517,943 2/1/2022 892.WDN 57288 3/1/2022 891.WTP 1,213,675 1,731,618 3/1/2022 892.WDN 2075333 4/1/2022 891.WTP 400,114 2,131,732 4/1/2022 892.WDN 2636699 5/1/2022 891.WTP 1,183,071 3,314,803 5/1/2022 892.WDN 1680526 6/1/2022 891.WTP (445,713) 2,869,090 6/1/2022 892.WDN 779186 7/1/2022 891.WTP 1,236,714 4,105,804 7/1/2022 892.WDN 1247430 8/1/2022 891.WTP 635,315 4,741,119 8/1/2022 892.WDN 3704731 9/1/2022 891.WTP 1,905,156 6,646,275 9/1/2022 892.WDN 14627970 10/1/2022 891.WTP 1,006,790 7,653,065 10/1/2022 892.WDN 1817216 11/1/2022 891.WTP 587,047 8,240,112 11/1/2022 892.WDN 6828367 12/1/2022 891.WTP (660,279) 7,579,833 12/1/2022 892.WDN -890622 1/1/2023 891.WTP (57,745) (57,745) 2/1/2023 891.WTP 20,236 (37,509) 3/1/2023 891.WTP (341) (37,850)