a415
a415

Reputation: 369

SSRS - Find first occurrence within row group where condition holds and display value

I need to get the first value within a large data-set, based on a row group where the condition holds true.

I.e: Get the First Value Where Deal Name is "ABC" and Type = "main" within a row group (scope) of a entire dataset.

I tried the following:

=IIF(Fields!DealName.Value="ABC" AND Fields!Type.Value="Main", First(Fields!DealValue.Value, "Deal"), NOTHING)

There are 3 records with distinct values for Deal Values. In this scenario, it is picking up 0, when it should have picked up 4946.

Can I have the entire if statement in a scope? Help would be immensely appreciated.

Upvotes: 1

Views: 2513

Answers (1)

BeiBei ZHU
BeiBei ZHU

Reputation: 363

If I understand it right, you want to get first value based on if condition. Then you can use LookUp

Lookup(1, IIF(Fields!DealName.Value="ABC" AND Fields!Type.Value="Main", 1, NOTHING), Fields!DealValue.Value, "DateSetName")

Upvotes: 2

Related Questions