Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi guys,
I would like to know if it's possible to do what I'm trying to do in Power BI. It must check conditions and based on it tell something about that comparision. Using excel is really easy to do that, just an If.
I'm planing to make a comparission tool.
Thank you,
Anderson.
Solved! Go to Solution.
Hi @andfx
Try this, where Table1 is the table you show:
1. Create a calculated one-column table that we will use to select the second name:
AuxTable = ALL(Table1[Name])
2. Place two slicers in your report, one with Table1[Name] and the other one with the created AuxTable[Name]
3. Create this measure and place it in a card
Measure =
VAR _Name1 =
SELECTEDVALUE ( Table1[Name] )
VAR _Name2 =
SELECTEDVALUE ( AuxTable[Name] )
VAR _Age1 =
SELECTEDVALUE ( Table1[Age] )
VAR _Age2 =
LOOKUPVALUE ( AuxTable[Age], AuxTable[Name], _Name2 )
VAR _SameAge = Age1 = _Age2
VAR _Eldest =
IF ( _Age1 > _Age2, _Name1, _Name2 )
VAR _Youngest =
IF ( _Age1 < _Age2, _Name1, _Name2 )
VAR _SameAgeMsg = _Name1 & " and " & _Name2 & " have the same age"
VAR _DiffAgeMsg = _Eldest & " is older than " & _Youngest
RETURN
IF ( _SameAge, _SameAgeMsg, _DiffAgeMsg )
You can also take pieces of that measure to create other measures that display the the ages as you show them.
Hi @andfx
Try this, where Table1 is the table you show:
1. Create a calculated one-column table that we will use to select the second name:
AuxTable = ALL(Table1[Name])
2. Place two slicers in your report, one with Table1[Name] and the other one with the created AuxTable[Name]
3. Create this measure and place it in a card
Measure =
VAR _Name1 =
SELECTEDVALUE ( Table1[Name] )
VAR _Name2 =
SELECTEDVALUE ( AuxTable[Name] )
VAR _Age1 =
SELECTEDVALUE ( Table1[Age] )
VAR _Age2 =
LOOKUPVALUE ( AuxTable[Age], AuxTable[Name], _Name2 )
VAR _SameAge = Age1 = _Age2
VAR _Eldest =
IF ( _Age1 > _Age2, _Name1, _Name2 )
VAR _Youngest =
IF ( _Age1 < _Age2, _Name1, _Name2 )
VAR _SameAgeMsg = _Name1 & " and " & _Name2 & " have the same age"
VAR _DiffAgeMsg = _Eldest & " is older than " & _Youngest
RETURN
IF ( _SameAge, _SameAgeMsg, _DiffAgeMsg )
You can also take pieces of that measure to create other measures that display the the ages as you show them.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 27 | |
| 23 | |
| 18 | |
| 18 | |
| 15 |
| User | Count |
|---|---|
| 54 | |
| 44 | |
| 42 | |
| 39 | |
| 33 |