equivalent look up if

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Power BI training and help » Equivalent of look up if

Equivalent of look up if

resolvedResolved · Low Priority · Version 2016

Equivalent of look up if

Hi,

I was wondering if it was possible to do a kind of If, vlookup equivalent on BI?
I have 4 tables, 1 is related to the three others. The main table is all alumni with their URNs. The other 3 are tables relating to specific activities, volunteering, events and communications. In the 3 smaller tables, a URN can appear multiple times but in the main alumni table, they only appear once.
I need to be able to show the total amount of alumni who appear in at least one of the other three tables. If they appear in all 3 is irrelevant, I just need to be able to show participation. I also need to filter this by current FY. The dates on each of the activity table are linked to my dates table. The main alumni table doesn't contain dates. IF 3000 alumni attended an event, and 2000 volunteered and 1000 were involved in comms, I know that's a total of 6000 instances of participation. But if 1000 of those who attended an event also volunteered, then my count would drop to 5000 which is what I need. Is there a way I can add a column for each activity on my main alumni table? Is that the smartest way to do this? I have used Countrows to attempt this, but don't seem to be able to include the date filter. Apologies if this isn't making sense!

RE: equivalent of look up if

Hi Lou,

Thank you for the forum question.

It is always challenging to answer question when it comes to DAX without having the data model.

I hope, I understand you right.



You will have to add 4 columns to your main table (dim) with the URN.

You need for each of your three fact tables to have a column in your dim table, and then you have to have a column in your dim table with if logic to handle that it is irrelevant if the alumni appears in all three tables.

Add below formula in three columns in your dim table.

Just change the field name and the fact table name.

"Field name" = countrows(RELATEDTABLE("fact table name"))


Please let me know if this is not working.




Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: equivalent of look up if

Hi Jens,

Thank you for coming back so fast!

I think have this bit sorted, so I have a column for each of the fact tables. What I need though is for those columns to only have a value if the date from the fact table is this year. Or to somehow bring the date over? I need to be able to filter on the date somehow which doesn't work when at the moment.

Thanks,
Lou

RE: equivalent of look up if

Hi Lou,

If you in the report filter it by year from your date table you should have only current year.

Have you used the year field from the date table?


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: equivalent of look up if

Hi Jens,

Yep I am using the year as usual but it doesn't affect numbers. I assumed this was because there's no date on the main table but maybe I'm wrong? All tables with dates are linked to the dates table, and when not used with the main table, the dates work as they should.

Thanks!

RE: equivalent of look up if

Hi Lou,


Sorry I am stupid. You cannot do it because of the filter direction.

Do you have more than the 5 tables in the model?

If you go to data model view and double click on the 3 relationships between the dim table and the three fact table and change the filter direction to BOTH.

Please let me know if it is working.


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: equivalent of look up if

Not at all!

That's fixed it! Thank you :)

 

Training courses

 

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Power BI tip:

Master DAX (Data Analysis Expressions)

DAX is the formula language used in Power BI for creating custom calculations and aggregations. Invest time in learning DAX to unlock the full potential of Power BI. Understand functions like CALCULATE, FILTER, and SUMX, as they are fundamental for creating complex calculations and measures.

View all Power BI hints and tips


Server loaded in 0.1 secs.