Forum Discussion

u035546's avatar
u035546
Frequent Visitor
3 years ago

Calculation based on top3 dates

Hello all. I am struggling with this calculation.

 

I have these three columns in the same query.

Of course there are more rows.

What I cannot do is COUNT the number of "Overall evaluation 0-4" corresponding to the TOPN 3 "Data prelievo" dates for each "Caratteristica".

 

I expect as output a visual table with two columns: 1) the counted number and 2) the date, on three rows only BTW.

 

 

What I have tried so far is a measure like:

 

CALCULATE(COUNT([Overall evaluation 0-4]) , [Caratteristica]="Durezza" , TOPN(3 , 'query/table name' , [Data prelievo] , DESC))

 

I can get the "Caratteristica" filtered, but never the top 3 related dates. Everytime I have all the existing dates as result and not only the first 3 rows. Note: I ain't looking fot the absolute last 3 dates in the table, I need the last 3 related to the column "Caratteristica".

 

Only for the record, I know for sure that there is only 1 value of "Overall ev." for a single day / date. It's a crosscheck that I need to do thus I cannot perform it by PBI built in filters.

 

Thanks in advance

No RepliesBe the first to reply