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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Frunkle93
Frequent Visitor

How to only count values in one column with condition max value in another column?

Hello,

 

I would only like the value in 'Beoordeling' to be counted when 'Startdatum' is Max. 

'Gevolmachtigde', 'Combitaak' and 'Jaar' should be unique.

So in this example, only the bold values should be counted.

If 'Gevolmachtigde', 'Combitaak' or 'Jaar' changes, again the Max value of 'Startdatum' should be calculated and the value of 'Beoordeling' should be counted.

 

GevolmachtigdeCombitaakJaar StartdatumBeoordeling
AACC-620201-3-2020Goed
AACC-620201-6-2020Goed
AACC-620201-9-2020Goed
AACC-620201-12-2020Goed
BACC-620201-3-2020Goed
BACC-620201-6-2020Goed
BACC-620201-9-2020Goed
BACC-620201-12-2020Goed

 

 

Hope this is clear. Thanks in advance.

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Frunkle93 ,

 

Try the following code:

Calculate = 
Var MaximumDate = MAX('Table'[Startdatum])

Return
CALCULATE( COUNT('Table'[Beoordeling]),'Table'[Startdatum] = MaximumDate)

 

MFelix_0-1651855403232.png

Based on your data the information is very reduced but has you can see I have made a change to the dataset and included a new line for B on the maximum date has you can see the result is updating

MFelix_1-1651855491779.pngMFelix_2-1651855500217.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Frunkle93 ,

 

Try the following code:

Calculate = 
Var MaximumDate = MAX('Table'[Startdatum])

Return
CALCULATE( COUNT('Table'[Beoordeling]),'Table'[Startdatum] = MaximumDate)

 

MFelix_0-1651855403232.png

Based on your data the information is very reduced but has you can see I have made a change to the dataset and included a new line for B on the maximum date has you can see the result is updating

MFelix_1-1651855491779.pngMFelix_2-1651855500217.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.