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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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

Hi @Anonymous ,

 

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
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

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.
Anonymous
Not applicable

@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

 

 

Hi @Anonymous ,

 

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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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