Forum Discussion
ClemFandango
Advocate II
2 years agoPopulate column based on month and value in another column using DAX
Hi all, I am trying to create a calculated column that returns “yes” for the whole month (of the date specified in date column below) where any ‘Ref’ has a value of 1 in ‘New’. The data table loo...
- 2 years ago
Hi,
Write this calculated column formula
Year = year(Data[Date])
Edit this formula
Column = if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Month number]=EARLIER(Data[Month number])&&[Year]=EARLIER(Data[Year])&&Data[Ref]=EARLIER(Data[Ref])&&Data[New]=1)),"Yes","No")
Ashish_Mathur
Super User
2 years agoHi,
Write this calculated column formula
Year = year(Data[Date])
Edit this formula
Column = if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Month number]=EARLIER(Data[Month number])&&[Year]=EARLIER(Data[Year])&&Data[Ref]=EARLIER(Data[Ref])&&Data[New]=1)),"Yes","No")ClemFandango
Advocate II
2 years agoAmazing Ashish_Mathur !
I also found that I could do this by creating column YearMonth instead of Year
YearMonth = YEAR(Data[Date])*100+Month(Data[Date])
This provides a numeric version of Year & Month combined.
Again thanks to Ashish_Mathur & Anonymous for all your help
- Ashish_Mathur2 years ago
Super User
You are welcome.