Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
eric0809
New Member

Compare value in dimension table

Hi,

 

I have a pretty standard datamodel that consists of a fact table and several dimension tables, all many-to-one relationships, unidirectional towards the fact table.

 

In the dimension table (DIM) there is value X that represents a certain number. I would like to create a measure (instead of a calculated column) that returns true or false based on whether the value is bigger than e.g. 2. This measure will be used in a table that has the key column of the fact table (FACT), and some of the columns in DIM.

I might be overthinking, but I can't get it to work.

 

I thought I could just use a lookupvalue like so:

MEASURENAME = LOOKUPVALUE(DIM[ColumnToShow], DIM[KeyColumn], SELECTEDVALUE(FACT[KeyColumn]) > 2

, but the table just keeps loading and ends up failing.

 

What am I forgetting here?

1 ACCEPTED SOLUTION

Hi Eric,

Please try

MyMeasure =
IF (
    CALCULATE (
        SELECTEDVALUE ( DIM[ColumnToShow] ),
        CROSSFILTER ( DIM[KeyColumn], FACT[KeyColumn], BOTH )
    ) > 2,
    1
)

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @eric0809 

try

MyMeasure =
CALCULATE (
    SELECTEDVALUE ( DIM[ColumnToShow] ),
    CROSSFILTER ( DIM[KeyColumn], FACT[KeyColumn], BOTH )
) > 2

Hi, thanks!

The calculate-part returns the correct value, but once I add the '>2' part, the whole table blows up and shows all possible combinations from both the fact and dimension tables.

Any suggestions on that?

Hi Eric,

Please try

MyMeasure =
IF (
    CALCULATE (
        SELECTEDVALUE ( DIM[ColumnToShow] ),
        CROSSFILTER ( DIM[KeyColumn], FACT[KeyColumn], BOTH )
    ) > 2,
    1
)

Hi,

This seems to work, thanks. The thing is, it only shows values for which the evaluation is true. I tried adding an alternative value (so IF( [...], 1, 0)), but that immediately made the table show every possible combination again. I am familiar with row context, but I can't figure out why this behaviour would be present, and how to deal with it.

I can't imagine calculated columns would be the only option here right..?

Hi Eric

If you have other measure in the table/matrix visual you should see balnks wehereever the condition is false. Just make sure measure in filter pane is set to ALL.

Hi Eric

If you have other measure in the table/matrix visual you should see balnks wehereever the condition is false. Just make sure measure in filter pane is set to ALL.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.