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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
selpaqm
Helper V
Helper V

merge queries with dividing with a data on another query

Hi,

I have sales figures on one excel but in different sheets like GBP, EUR and USD sheets and all sheets are on same headers. as below 

WeekCustomerQTYsales

On weekly basis, I am collating data on sharepoint folder. 

and also I have another table for currencies.

WeekGBPUSDEUR
111.151.33
211.161.35
311.151.34

 

So I want to create one query like;

GBP Sheet

WeekCustomerQTYsales
1aaa100500
2bbb3001500

 

EUR Sheet

WeekCustomerQTYsales
1ccc50100
2ddd100200

 

USD sheet

WeekCustomerQTYsales
1eee5001000
2fff10002000

 

Result

WeekCustomerQTYsales
1aaa100500/1
1ccc50100/1.15
1eee5001000/1.33
2bbb3001500/1
2ddd100200/1.16
2fff10002000/1.35
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @selpaqm , 

Please refer to my pbix file to see if it helps you.

First, insert a custom in USD sheet,GBP sheet and EUR sheet like the following.

vpollymsft_0-1650263111320.png

Then append the three sheet as new.

vpollymsft_1-1650263149707.png

Then create two columns.

Column = MONRY[Week]&"-"&MONRY[Attribute]
Column = Append1[Week]&"-"&Append1[Custom]

Finally ,create a measure.

Measure =
VAR _result =
    CALCULATE (
        MIN ( MONRY[Value] ),
        FILTER ( ALL ( MONRY ), MONRY[Column] = SELECTEDVALUE ( Append1[Column] ) )
    )
RETURN
    MAX ( Append1[sales] ) & "/" & _result

vpollymsft_2-1650263491954.png

 

Best Regards

Community Support Team _ Polly

 

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

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @selpaqm , 

Please refer to my pbix file to see if it helps you.

First, insert a custom in USD sheet,GBP sheet and EUR sheet like the following.

vpollymsft_0-1650263111320.png

Then append the three sheet as new.

vpollymsft_1-1650263149707.png

Then create two columns.

Column = MONRY[Week]&"-"&MONRY[Attribute]
Column = Append1[Week]&"-"&Append1[Custom]

Finally ,create a measure.

Measure =
VAR _result =
    CALCULATE (
        MIN ( MONRY[Value] ),
        FILTER ( ALL ( MONRY ), MONRY[Column] = SELECTEDVALUE ( Append1[Column] ) )
    )
RETURN
    MAX ( Append1[sales] ) & "/" & _result

vpollymsft_2-1650263491954.png

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

amitchandak
Super User
Super User

@selpaqm , I each sheet add sheet name(Curr Name) as column and create a combined column with [Week] & "-" [Curr name]

Unpivot the first table and create a new column there too [Week] & "-" [Curr name]

 

Merge these tables now and get the rate, you can now create new column to use rate abe value

 

https://radacad.com/pivot-and-unpivot-with-power-bi
Append : https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.