Forum Discussion
Anonymous
3 years agoNot applicable
undefined
Hi everyone. Need your help for this one. Here's my sample data.
| Batch | KeyID | Criteria |
| 1 | some1 | Y |
| 1 | some2 | N |
| 2 | some3 | Y |
| 2 | some4 | N |
| 2 | some5 | Y |
| 2 | some6 | N |
So I have a measure that calculates the count of KeyIDs with regards to a criteria:
KeyID Count = CALCULATE(COUNT(KeyID), Criteria = "Y")
I have the batch as a filter in a slicer.
So, I'm at my wits' end, and maybe you folks could help. I want to count the values of the previous batch relative to what the current filter is.
So in this example. say the filter is Batch = 2, the measure above will evaluate to 2. Then, in another visual, I want to show the number 1 (while the filter Batch = 2, then the Batch for that visual will be 1).
I have the batch as a filter in a slicer.
So, I'm at my wits' end, and maybe you folks could help. I want to count the values of the previous batch relative to what the current filter is.
So in this example. say the filter is Batch = 2, the measure above will evaluate to 2. Then, in another visual, I want to show the number 1 (while the filter Batch = 2, then the Batch for that visual will be 1).
I tried using this:
CALCULATE([KeyID Count], [Batch] -1) to no avail.
Thanks for your help!
Thanks for your help!
try to create two measures with this:
KeyIDCount := CALCULATE(COUNT(TableName[KeyID]), TableName[Criteria] = "Y")KeyIDCountPrevBatch :=VAR CurrentBatch = MAX(TableName[Batch])RETURNCALCULATE([KeyIDCount],TableName[Batch]=CurrentBatch-1)i tried and it worked like this:
2 Replies
- FreemanZSuper User
try to create two measures with this:
KeyIDCount := CALCULATE(COUNT(TableName[KeyID]), TableName[Criteria] = "Y")KeyIDCountPrevBatch :=VAR CurrentBatch = MAX(TableName[Batch])RETURNCALCULATE([KeyIDCount],TableName[Batch]=CurrentBatch-1)i tried and it worked like this: - AnonymousNot applicable
That was fast! Thanks it worked! Gotta learn variables I guess.