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.
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
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 356 members 3,408 guests
Please welcome our newest community members: