Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Irwin
Helper IV
Helper IV

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

Static01-01-202131-03-2021
Static01-01-202131-03-2021
Static01-01-202131-03-2021
Static01-01-202130-06-2021
Static01-01-202130-06-2021
Static01-01-202230-06-2022
Static01-01-202230-06-2022
Static01-01-202230-06-2022
Static01-01-202230-06-2022
Static01-01-202230-06-2022
Static01-01-202230-09-2022
Static01-01-202230-09-2022
Static01-01-202231-12-2022
Static01-01-202231-12-2022
Static01-01-202231-12-2022
Static01-01-202231-12-2022
Static01-01-202231-12-2022
Dynamic01-01-2022 
Dynamic01-01-2022 



1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Irwin Perhaps:

Dynamic = IF([Assignment] = "Dynamic",CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Assignment]="Dynamic")),BLANK())

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Irwin
Helper IV
Helper IV

Guys, this was so simple I should have known.   Thanks a bunch for your help! It worked instantly 🙂 ❤️ 

Greg_Deckler
Super User
Super User

@Irwin Perhaps:

Dynamic = IF([Assignment] = "Dynamic",CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Assignment]="Dynamic")),BLANK())

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
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())

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors