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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
vito123
Helper II
Helper II

Need help in performing this query using DAX or power Query editor

Hi Guys, 

 

I have 2 tables:

Table-1:

 

Tower Model IDMin Level Max Level

1

1020
22030
31040

Table:-2

 

Tower Model IDLevelSRF
1101.4
1111.8
1171.9
1251.11
2

20

1.4
2211.4
2271.4
2281.4
2351.1
3101.1
3121.1
3201.1
3251.1
3301.1
3451.1

 

Now mylevels are defined in table 1 and I need to extract the corresponding SRF's from Table -2 between these 2 levels so for example for tower model id 1 I need all SRF values from table 2 from level 10 to level 17 (  SRF values from level 10 to 20 only )

 

So desired output Table

 

Tower MOdel IDLEVEL SRF
1101.4
1111.8
1171.9
2201.4
2211.4
2271.4
2281.4
3101.1
3121.1
3201.1
3251.1
3301.1

 

Would this help 

SRF= Calculate ( table2(SRF) , table1(minlevel)<table2(level) <table1(maxlevel)

but could someone help me with this please?

3 REPLIES 3
vito123
Helper II
Helper II

Guys could someone please help me on this ?

@vito123,

 

This solution requires a one-to-many relationship between the tables:

 

DataInsights_0-1710192585730.png

 

Create DAX calculated table:

 

OutputTable = 
FILTER (
    Table2,
    Table2[Level] >= RELATED ( Table1[Min Level] )
        && Table2[Level] <= RELATED ( Table1[Max Level] )
)

 

DataInsights_1-1710192636020.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks a lot @DataInsights , Sorry For not correctly explaining my problem earlier but just realized that I have many to many relationship , please see below:

 

1.) Sorry If I was not clear ,Since I am having a Many-Many relationship I am seeing the below error:

vito123_0-1710224399308.png

 

So my table 1 has repeated occurence of towermodelID

 

Table-1:

 

Tower Model IDTowermodel SectionMin Level Max Level

1

1_11020

1

1_22125

1

1_32630
22_12030
22_23140
33_11040
33_24150

 

Table:-2

Tower Model IDLevelSRF
1101.4
1111.8
1171.9
1251.11
2

20

1.4
2211.4
2271.4
2281.4
2351.1
3101.1
3121.1
3201.1
3251.1
3301.1
3451.1

 

Table 3: intermediate output

Tower MOdel IDTowermodel SectionLEVEL SRF
11_1101.4
11_1111.8
11_1171.9
11_2251.11
22_1201.4
22_1211.4
22_1271.4
22_1281.4
22_2351.11
33_1101.1
33_1121.1
33_1201.1
33_1251.1
33_1301.1
33_2451.1

 

Finally I need the below output ( Now for a normal table I can open this in query editor and do aggregation but if it is a calculated table then how to proceed ?)

 

Final Table output desired : I need the min SRF in each of the towermodel section 

 

Table 4:Final Output

Tower MOdel IDTowermodel SectionLEVEL MIN SRF
11_1101.4
11_2251.11
22_1201.4
22_1211.4
22_1271.4
22_1281.4
22_2351.11
33_1101.1
33_1121.1
33_1201.1
33_1251.1
33_1301.1
33_2451.1

 

 

 

2..) I was hoping to know if we can convert this calculated table as a normal table that can be opene din query editor because I need to some more joins and aggregations on top of this table. 

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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