KnifeandFork
New Member
- Joined
- Jan 9, 2014
- Messages
- 5
Hi all!
I'm desperately trying to get PowerPivot to count the number of 'L's in a column. L itself is a measure, which returns 'L' for stores which have not bought in over a year (and are therefore Lost) and blank for all other cases. When I try the following function:
=calculate(DISTINCTCOUNT([Store]),[Lost]="L")
I get the following error:
Calculation error in measure 'Table1 1'[98cc8508-821c-4611-9777-c96938814971]: A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
The original source file is structured as follows, so I cannot do it directly in the file, as Quarters are in rows and not columns:
[TABLE="width: 320"]
<tbody>[TR]
[TD="width: 64"]Country[/TD]
[TD="width: 64"]Store[/TD]
[TD="width: 64"]Brand[/TD]
[TD="width: 64"]Quarter[/TD]
[TD="width: 64"]Sales[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]a[/TD]
[TD]X[/TD]
[TD]Q1[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]b[/TD]
[TD]Y[/TD]
[TD]Q1[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]c[/TD]
[TD]Y[/TD]
[TD]Q1[/TD]
[TD="align: right"]27[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]a[/TD]
[TD]Y[/TD]
[TD]Q1[/TD]
[TD="align: right"]74[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]c[/TD]
[TD]X[/TD]
[TD]Q1[/TD]
[TD="align: right"]206[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]a[/TD]
[TD]X[/TD]
[TD]Q2[/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]b[/TD]
[TD]Y[/TD]
[TD]Q2[/TD]
[TD="align: right"]215[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]c[/TD]
[TD]X[/TD]
[TD]Q2[/TD]
[TD="align: right"]191[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]d[/TD]
[TD]Y[/TD]
[TD]Q2[/TD]
[TD="align: right"]197[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]e[/TD]
[TD]Z[/TD]
[TD]Q2[/TD]
[TD="align: right"]189[/TD]
[/TR]
</tbody>[/TABLE]
Any ideas?
Thanks!
I'm desperately trying to get PowerPivot to count the number of 'L's in a column. L itself is a measure, which returns 'L' for stores which have not bought in over a year (and are therefore Lost) and blank for all other cases. When I try the following function:
=calculate(DISTINCTCOUNT([Store]),[Lost]="L")
I get the following error:
Calculation error in measure 'Table1 1'[98cc8508-821c-4611-9777-c96938814971]: A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
The original source file is structured as follows, so I cannot do it directly in the file, as Quarters are in rows and not columns:
[TABLE="width: 320"]
<tbody>[TR]
[TD="width: 64"]Country[/TD]
[TD="width: 64"]Store[/TD]
[TD="width: 64"]Brand[/TD]
[TD="width: 64"]Quarter[/TD]
[TD="width: 64"]Sales[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]a[/TD]
[TD]X[/TD]
[TD]Q1[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]b[/TD]
[TD]Y[/TD]
[TD]Q1[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]c[/TD]
[TD]Y[/TD]
[TD]Q1[/TD]
[TD="align: right"]27[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]a[/TD]
[TD]Y[/TD]
[TD]Q1[/TD]
[TD="align: right"]74[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]c[/TD]
[TD]X[/TD]
[TD]Q1[/TD]
[TD="align: right"]206[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]a[/TD]
[TD]X[/TD]
[TD]Q2[/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]b[/TD]
[TD]Y[/TD]
[TD]Q2[/TD]
[TD="align: right"]215[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]c[/TD]
[TD]X[/TD]
[TD]Q2[/TD]
[TD="align: right"]191[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]d[/TD]
[TD]Y[/TD]
[TD]Q2[/TD]
[TD="align: right"]197[/TD]
[/TR]
[TR]
[TD]Armenia[/TD]
[TD]e[/TD]
[TD]Z[/TD]
[TD]Q2[/TD]
[TD="align: right"]189[/TD]
[/TR]
</tbody>[/TABLE]
Any ideas?
Thanks!