cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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 more quickly.

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 more quickly.
Highlighted
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 more quickly.

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 385 members 3,045 guests
Please welcome our newest community members: