Forum Discussion
Problem with Calculated Column
Hi guys,
I have a table with the sample like this:
| Date | Customer |
| 1/1/2015 | A |
| 1/1/2015 | B |
| 1/1/2015 | C |
| 1/1/2015 | D |
| 1/1/2015 | E |
| 1/1/2015 | F |
| 1/1/2015 | G |
| 1/1/2015 | H |
| 2/1/2015 | A |
| 2/1/2015 | B |
| 2/1/2015 | D |
| 2/1/2015 | E |
| 2/1/2015 | F |
| 2/1/2015 | C |
| 2/1/2015 | I |
| 2/1/2015 | J |
| 2/1/2015 | K |
| 2/1/2015 | L |
| 2/1/2015 | M |
| 2/1/2015 | N |
| 3/1/2015 | A |
| 3/1/2015 | B |
| 3/1/2015 | C |
| 3/1/2015 | E |
| 3/1/2015 | D |
| 3/1/2015 | F |
| 3/1/2015 | G |
| 3/1/2015 | H |
| 3/1/2015 | I |
| 3/1/2015 | J |
| 4/1/2015 | A |
| 4/1/2015 | B |
| 4/1/2015 | C |
| 4/1/2015 | D |
| 4/1/2015 | E |
| 4/1/2015 | F |
I wanted to create a calculated column with this formula:
"Prev12Members = CALCULATE(DISTINCTCOUNT(Table[Customer]), SAMEPERIODLASTYEAR(Table[Date]))"
However, it does not result in any values. It worked when I tried creating a measure and created a table (Visualization) with Date & this measure. Just wonder if it is possible to create calculated column as mentioned? Any insight will be greatly appreciated! Thanks!
Regards,
Henry
Hi,
Try this formula
=CALCULATE( AVERAGEX(VALUES(Customer[Date]), [Churn Rate]), DATESBETWEEN ( Customer[Date], EDATE(MIN(Customer[Date]),-11),MAX(Customer[Date])))
Hope this helps.
13 Replies
- Ashish_MathurSuper User
Hi,
That will not work as a calculated column - it will only work as a measure. But if the measure is already working for you, why do you want to write that as a calculated column?
- henryvu93Helper I
Hi Ashish_Mathur,
Thanks for your reply. Actually after this step, I want to summarize the table into a new table with date & the measure. However, with the measure "Prev12Members", my table did not show anything. I am thinking if I can create a column and summarize the table based on that column it might be possible.
Regards,
Henry
- Ashish_MathurSuper User
Hi,
Please describeyour entire question and show the expected result.