Forum Discussion
Relate one column whith another colunm inside a subselect
- 9 years ago
I created a new Column and use that DAX:
Variancy =
VAR lastYear = 'Basis 1'[Year] - 1
VAR actualYear = 'Basis 1'[Year]
Return
COUNTROWS(FILTER('Basis 1';'Basis 1'[Year] = actualYear))- COUNTROWS(FILTER('Basis 1';'Basis 1'[Year] = lastYear))
That resolved my problem!
Tk's dedelman_clng
=D
Can you explain (not in SQL code) what value you are trying to find? SQL code doesn't always translate easily to DAX, but knowing the requirement would get you pointed in the right direction.
I need to calculate the variancy of the proposals by the year for the waterfall chart. I have a table with the proposals IDs and the year of the proposal. so, I need to calculate the diference of the number of proposals of the previous year and the number of proposals of the year that the column make reference. That`s possible?
- dedelman_clng9 years ago
Community Champion
You will want to add a date table to your data model, so you can make use of time intelligence functions. Once you have that, and join it to the rest of your model, you can use the SAMEPERIODLASTYEAR() function. For example
CountVariance = CALCULATE( COUNT('Proposal'[ID]) ) - CALCULATE( COUNT('Proposal'[ID]), SAMEPERIODLASTYEAR('Proposal'[Date]) )