The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have below table. I don't have Previous Day column and wanted create Total Value column as per the below table. Is it possible to get that. The first date in a month I wanted to pass as zero for Previous day value. And the same should applies if I have multiple Sr No's (Product Line, Product Line 2 and so on....
Any help in DAX?
Sr No | Date | A | B | C | Previous Day Value | Total Value |
Product Line 1 | 01-Jan-24 | 20 | 30 | 40 | 0 | 20+30+40+0 (This zero value is default at the starting day of a month . So total value should be 90 |
Product Line 1 | 02-Jan-24 | 13 | 43 | 5 | 13+43+5+90 (This 90 value is nothing but previous day). So total value should have 151 | |
Product Line 1 | 03-Jan-24 | 18 | 30 | 22 | 18+30+22+151 (This 151 value is nothing but previous day value. So total value should be 221 |
No, data needed in that format only. thanks
Create a calculated column that adds up A, B and C. Create a running total quick measure over that column
No, as I mentioned need day wise that calculated column Total Value.
No, the previous day values I am using it for comparison purpose not for adding. so running will not work.
It is not clear to me what your desired output is. Please elaborate.
actually the formula for Total Value is SUM(A+B+C-(Targetvalue-Previousdayvalue). For 1st day of month previous value is zero as a static value passing. whatever value I am getting that value should pass it on 2nd day total value.
For 2nd day the Total value is SUM(A+B+C -(Targetvalue-1stdayTotalvalue).
2nd day, 1stdayTotalvalue will become previousday value for 2nd day.
For 3rd day total value is SUM(A+B+C-(Targetvalue-2ndtotalvalue).
3rd day, 2nd day Total Value will become previousday value for 3rd day..
and so on.
My proposal produces the same result, but in a simplified manner, without the need for intermediate columns.
What will happen if 4th day get Totalvalue as zero, then I should be doing Targetvalue-Previous day value (then my previous day value shouldn't be running sum, I should pass as zero. that scenario will get failed above solution.
You cannot do conditional aggregations in DAX. They are only possible in Power Query.
Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.
Unpivot your A, B and C columns to bring them into a usable format. Then use a "Running Total" Quick measure.