Forum Discussion
ccueto36
8 years agoFrequent Visitor
Offsetting Calculated Column Rows
Hi guys, I'm having a bit of a dilemma with generating a Calculated Column in DAX, the goal is to calculate Cal_charge+Amt column from the Excel table above. As you can see, the data on that ...
ccueto36
8 years agoFrequent Visitor
I've been trying this since yesterday but to no avail. I'm getting a fully blank calculated column as a result every time I try it. If I take off the IF(COUNTROWS(temp1) = 2 condition, then it's not blank anymore, just random numbers that isn't the expected answer. On a side note, Table3 is the table name where all of the above columns are from?
Zubair_Muhammad
Community Champion
8 years ago
When I use it with a sample table it works
Please see Power Pivot model in attached Excel Workbook
- ccueto368 years agoFrequent Visitor
Thank you for the sample, I can also make it work just fine in Excel Power Pivot but the same does not seem to work in Power BI Calculated Column, keeps returning blank column :/
- v-danhe-msft8 years ago
Microsoft Employee
Hi ccueto36,
Based on my test, I have tried what Zubair suggested, it could work on my side, and you could also refer to my step:
Sample data:
Create a calculated column:
Column 2 = var a=MONTH('Table3'[Month-Year])-2 return CALCULATE(SUM(Table3[Sum of ChargeAmt]),FILTER('Table3',MONTH('Table3'[Month-Year])=a))Result(Column1 is the Zubair's function):
You could also download the pbix to have a view, if it still could not work, could you please share the pbix if possible?
https://www.dropbox.com/s/jjdh69fw2ipjbr4/Offsetting%20Calculated%20Column%20Rows.pbix?dl=0
Regards,
Daniel He