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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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

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

View solution in original post

3 REPLIES 3
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

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

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.

 

 

Anonymous
Not applicable

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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