Forum Discussion
gmasta1129
Resolver I
3 years agoFormula to pull in previous day balance
Hello, I am looking to pull the previous run date (second column) USD balance (7th column) if the "if value date/Run date" column is equal to "Y". For example, the new column should c...
- Anonymous3 years ago
Hi gmasta1129 ,
Please adjust the measure with below dax formula:
Measure = VAR cur_rk = [RK] VAR cur_flexacct = SELECTEDVALUE ( 'Table'[flex_acct] ) VAR cur_cd = SELECTEDVALUE ( 'Table'[if ValueDaate/Run Date] ) VAR tmp = FILTER ( ALL ( 'Table' ), 'Table'[flex_acct] = cur_flexacct && [RK] = cur_rk - 1 ) VAR _val = CALCULATE ( MAX ( 'Table'[usd_balance] ), tmp ) VAR cur_rd = SELECTEDVALUE ( 'Table'[Run Date] ) VAR _pre_date = CALCULATE ( MAX ( 'Table'[Run Date] ), tmp ) VAR cd = DATEDIFF ( cur_rd, _pre_date, DAY ) RETURN IF ( DAY ( cur_rd ) = 1 && cd <> 1, 0, IF ( cur_cd = "N", 0, _val ) )Please refer the attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
gmasta1129
Resolver I
3 years agoHello djurecic,
Thank you for the quick response but I would need the previous day balance to pull into the column. Threfore 10/31/2022 run date balance of 800,000 should pull into the first row and 0 should pull into the second row.