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

How to get data from two different created referenced tables for different measures

HI,

 

I am still learing my ropes in powerbi and DAX.

 

MTRA, MTRC, MTRE,  are from different table which i created from edit queries, KMAT1-KMAT2 are from another table which Icreated from edit queries.

KAY1 to KAY6 are measures.

 

See field relation below

MTRA

KMAT-1

KAY1

MTRC

KMAT-1

KAY2

MTRE

KMAT-1

KAY3

MTRA

KMAT-2

KAY4

MTRC

KMAT-2

KAY5

MTRF

KMAT-2

KAY6

 The displayed data are supposed to be different values as they are feeding differently from another table which has KMAT-1 and KMAT-2 .

 

I’ve created the tables and made the relationships..

Now With ‘SWITCH’, I can now display KAY1-KAY6

 

But the data output is same for KAY1 and KAY4…and KAY2 and KAY5 which is not supposed to be so .

 

 

 

Please I want to be able to display data for each selected site for each particular day.

I've tried different Switch statement but they still output same values for KAY1/KAY4 and KAY2/KAY5.

 

STATION = SWITCH(BH1_Seismic[Member],"MTRA","KAY1","MTRC","KAY2","MTRE","KAY3","MTRA","KAY4","MTRC","KAY5","MTRF","KAY6",BH1_Seismic[Member])

 

 Also If I select KAY2 and KAY5, same time, or KAY1 and KAY4 same time, The bar chart disappears.

*****************************************************************************************************************************

Measure To Display =
 SWITCH( TRUE(),
   VALUES('STATION'[STATION]) = "KAY1", [KAY1],
   VALUES('STATION'[STATION]) = "KAY2", [KAY2],
   VALUES('STATION'[STATION]) = "KAY3", [KAY3],
    VALUES('STATION'[STATION]) = "KAY4", [KAY4],
    VALUES('STATION'[STATION]) = "KAY5", [KAY5],
    VALUES('STATION'[STATION]) = "KAY6", [KAY6],
BLANK())

************************************************************************************************

I have tried different SWITCH for the 'Measure To Display' but  still output same values for KAY1/KAY4 and KAY2/KAY5.

 

Maybe a DAX statement like 'LOOKUP' or 'IF' or anyworkaorund to achieve this??

 

 

Please Help

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
ichebobo Member
Member

Re: How to get data from two different created referenced tables for different measures

Dale,

 

Your solution worked perfectly.

 

StationID = LOOKUPVALUE(GROUND[GROUND],GROUND[PALOR],[PALOR],STATION[MAKER],RELATED(B2020_LITTER[MAKER]))

 

Thank you so much for your time and patience

3 REPLIES 3
Community Support Team
Community Support Team

Re: How to get data from two different created referenced tables for different measures

Hi @ichebobo,

 

Could you please provide a dummy sample in TEXT mode? The PBIX file would be great. Apparently, the SWITCH sentence looks good here. The cause could be the relationships, the formulas of KEYs.

 

Best Regards!

Dale

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

Re: How to get data from two different created referenced tables for different measures

Hi Dale,

 

Thanks for your time.

 

The switch statement is not getting the desired data based on the relationship  outlined.

 

I've sent the PBIX file in DROPBOX to your mail.

 

 

Highlighted
ichebobo Member
Member

Re: How to get data from two different created referenced tables for different measures

Dale,

 

Your solution worked perfectly.

 

StationID = LOOKUPVALUE(GROUND[GROUND],GROUND[PALOR],[PALOR],STATION[MAKER],RELATED(B2020_LITTER[MAKER]))

 

Thank you so much for your time and patience