question

gphour avatar image
gphour asked

SSRS SQL Expression to compare two textboxs values to get third

In My report, I am getting Values in Two different textboxes I need to compare these two textboxes with two datasets fields and get value from third Field (Column).

For example; =LOOKUP(ReportItems!HEALTH_PROFESSIONALS_NAME.Value, Fields!MHEALTH_PROFESSIONALS_NAME.Value, Fields!MBudget.Value, "MBudget")

This works fine but only compare one item to another. I need to compare two fields to get value of "Fields!MBudget.Value"

I tried following but no result;

=LOOKUP(ReportItems!HEALTH_PROFESSIONALS_NAME.Value, Fields!MHEALTH_PROFESSIONALS_NAME.Value AND ReportItems!MONTH_OF_DATE.Value, Fields!MMONTH_OF_DATE.Value, Fields!MBudget.Value, Fields!MBudget.Value, "MBudget")

IIF(ReportItems![HEALTH_PROFESSIONALS_NAME].Value = Fields![MHEALTH_PROFESSIONALS_NAME].Value AND ReportItems![MONTH_OF_DATE].Value = Fields![MAPPOINTMENT_MONTH].Value,"Fields!MBudget.Value","")

Please HELP

sql-server-2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jon Crawford avatar image
Jon Crawford answered

Can you do it in the dataset, rather than the field formula?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gphour avatar image
gphour answered

Hi Jon

I have managed to do it;

=LOOKUP(Fields!HEALTH_PROFESSIONALS_NAME.Value+Fields!MONTH_OF_DATE.Value, Fields!MHEALTH_PROFESSIONALS_NAME.Value+Fields!MMONTH_OF_DATE.Value, Fields!MBudget.Value, "MBudget")

I was able to use "+" sign to connect both Columns in lookup Function.

Thanks for your reply.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.