Forum Discussion
Calculated column with "year" filter
Hi guys,
I have a table with some data that I would like to separate into a new calculated column.
I would like to create a column where I sumarize all the assignments that are 'Dynamic' and sort by year.
Ie. in my little cut out from the data, that would mean 2 from 2022 and none from 2021.
However I cannot seem to create the correct filter that puts blank in 2021. Instead I just get "2" in all fields in my calculated column.
I use: Dynamic = CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Assignment]="Dynamic"))
I have my table setup correctly with a date table. (I can easily make graphs etc where I use dates)
What filter/ekstra measure/etc do I need to do this?
Thank you very much for your help.
Assignment Start date Deadline
| Static | 01-01-2021 | 31-03-2021 |
| Static | 01-01-2021 | 31-03-2021 |
| Static | 01-01-2021 | 31-03-2021 |
| Static | 01-01-2021 | 30-06-2021 |
| Static | 01-01-2021 | 30-06-2021 |
| Static | 01-01-2022 | 30-06-2022 |
| Static | 01-01-2022 | 30-06-2022 |
| Static | 01-01-2022 | 30-06-2022 |
| Static | 01-01-2022 | 30-06-2022 |
| Static | 01-01-2022 | 30-06-2022 |
| Static | 01-01-2022 | 30-09-2022 |
| Static | 01-01-2022 | 30-09-2022 |
| Static | 01-01-2022 | 31-12-2022 |
| Static | 01-01-2022 | 31-12-2022 |
| Static | 01-01-2022 | 31-12-2022 |
| Static | 01-01-2022 | 31-12-2022 |
| Static | 01-01-2022 | 31-12-2022 |
| Dynamic | 01-01-2022 | |
| Dynamic | 01-01-2022 |
Irwin Perhaps:
Dynamic = IF([Assignment] = "Dynamic",CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Assignment]="Dynamic")),BLANK())
3 Replies
- Irwin
Helper IV
Guys, this was so simple I should have known. Thanks a bunch for your help! It worked instantly 🙂 ❤️
- amitchandak
Super User
Irwin , You should create a measure like
CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Assignment]="Dynamic"))
or
a column like if('Table'[Assignment]="Dynamic" ,
CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Assignment]="Dynamic")), blank())
- Greg_Deckler
Community Champion
Irwin Perhaps:
Dynamic = IF([Assignment] = "Dynamic",CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Assignment]="Dynamic")),BLANK())