Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

undefined

Hi everyone. Need your help for this one. Here's my sample data.

 

BatchKeyIDCriteria
1some1Y
1some2N
2some3Y
2some4N
2some5Y
2some6N

 

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 tried using this:

CALCULATE([KeyID Count], [Batch] -1) to no avail.

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])
    RETURN
    CALCULATE(
        [KeyIDCount],
        TableName[Batch]=CurrentBatch-1
    )
     
    i tried and it worked like this:

     

2 Replies

  • try to create two measures with this:

    KeyIDCount := CALCULATE(COUNT(TableName[KeyID]), TableName[Criteria] = "Y")
    KeyIDCountPrevBatch :=
    VAR CurrentBatch = MAX(TableName[Batch])
    RETURN
    CALCULATE(
        [KeyIDCount],
        TableName[Batch]=CurrentBatch-1
    )
     
    i tried and it worked like this:

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    That was fast! Thanks it worked! Gotta learn variables I guess.