Forum Discussion

MSW's avatar
MSW
Icon for Helper I rankHelper I
4 years ago
Solved

Counting by Multiple Conditions in Column

Hello, 

 

I am currently trying to make a dynamic column so that when its used it will change according to the Fiscal year. I currently have column that is static. The goal is to count the number of times a certain value appears in the dataset. Rather instead what I would like is to find the number of times the value appears per Fiscal year. 

I tried the following with no success. Wondering what other options I have to join these statements to get one output? 

Var id_value = 'table 1' [ID]

return

IF('Table 1'[Year] = "2000",

COUNTROWS(FILTER(ALL('Table 1'), 'Table 1'[Year] = "2000" && 'Table 1'[ID] = id_value)))

This returns the initial part I want but I want a calculation for other years as well. I have tried to join similiar statements together but end up with true false rather than an output. 

 

Date looks like this: 

ID

Year

123

2019
3452019
1232000
3452000

 

 

Thank you much appreciated. I do need it in a column as well not a measure as I need to be able to use different aggregates with the column

 

Thanks

  • Hello:

    You can give this a shot. You almost had it.

     

    Count =
    var vid = 'Table 1'[ID]
    var vyr = 'Table 1'[Year]
    return
    COUNTROWS(
    FILTER(ALL('Table 1'),
    'Table 1'[ID] = vid &&
    'Table 1'[Year] = vyr)
    )
    I hope this solves the question!

6 Replies

  • tackytechtom This doesn't appear to work. It will not allow for the table 1 Year into the measure. Also ideally would like to make this a column.

  • Hello:

    You can give this a shot. You almost had it.

     

    Count =
    var vid = 'Table 1'[ID]
    var vyr = 'Table 1'[Year]
    return
    COUNTROWS(
    FILTER(ALL('Table 1'),
    'Table 1'[ID] = vid &&
    'Table 1'[Year] = vyr)
    )
    I hope this solves the question!