cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
wayers Member
Member

DAX Help - Lookup to return value found in a measure

Hi community,

I am trying to create a measure to return the difference between two rows where the row data is from a measure. Below are the details of data model. I am looking for a solution that is a measure (or measures) rather than using several calculated columns. Any help is much appreciated.

 

The model has 2 tables, Table and WeightingsTable (shown below with relationship)

test1.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Below is the measure I use to derive value of our data using the weightings

DataWT = IF(
    HASONEVALUE('Table'[DataID]), 
    CALCULATE(SUM('Table'[Data]) * MIN(WeightingsTable[Weighting])/100), 
    SUMX(VALUES('Table'[DataID]),
    CALCULATE(SUM('Table'[Data]) * MIN(WeightingsTable[Weighting])/100))
    )

I am trying to return the difference ("Delta" column) of the weighted value between the RunID and the Ref ID. (shown below). The RefID is used to indicate what RunID data to compare with.

 

test3.JPG

Thanks for any assistance provided!!

 

Sample PBIX File

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: DAX Help - Lookup to return value found in a measure

Hi @wayers ,

 

You need to filter delta and let it be "is not blank".

 

Capture2.PNG

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: DAX Help - Lookup to return value found in a measure

Hi @wayers ,

Firstly, make a copy of “table”.

TableC = 'Table'

Then edit relationships with WeightingsTable and table.3-1.PNG

Create a new measure DataWT2 like DataWT based on TableC and create a new measure delta.

delta =
VAR c1 =
    SELECTEDVALUE ( 'Table'[RefID] )
VAR c2 =
    SELECTEDVALUE ( 'TableC'[RunID] )
RETURN
    IF ( c1 = c2, [DataWT2] - [DataWT] )

At last, you can get the visual.3-2.PNG

 

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
wayers Member
Member

Re: DAX Help - Lookup to return value found in a measure

@v-eachen-msft,

I am able to return the correct values but am having trouble getting the visual to match what you have shown.

This is what I see (image).

test4.JPG

Thoughts?

 

Link to PBIX  use TestUpdate

 

 

Community Support Team
Community Support Team

Re: DAX Help - Lookup to return value found in a measure

Hi @wayers ,

 

You need to filter delta and let it be "is not blank".

 

Capture2.PNG

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors