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
jonoren
Frequent Visitor

Many to Many relationship Standard Deviation Calculation

For the example, I have 2 simple tables: 

1. Countries Table:

CountryID  Name                CurrencyCode
1United StatesUSD
2United KingdomGBP
3CanadaCAD
4GermanyEUR
5FranceEUR

 

2. CurrencyExchangeRates Table:

CountryDateCurrencyCodeValue
1;1/1/2022USD1
1;1/2/2022USD1
1;1/3/2022USD1
2;1/1/2022GBP1.2
2;1/2/2022GBP1.3
2;1/3/2022GBP1.35
3;1/1/2022CAD0.7
3;1/2/2022CAD0.6
3;1/3/2022CAD0.8
4;1/1/2022EUR1.02
4;1/2/2022EUR1.1
4;1/3/2022EUR0.9
5;1/1/2022EUR1.02
5;1/2/2022EUR1.1
5;1/3/2022EUR0.9

 

And I'm trying to somehow end up with the following countries table:

 

CountryIDNameCurrencyCodeStandard Deviation
1United StatesUSD0
2United KingdomGBP0.076376262
3CanadaCAD0.1
4GermanyEUR

0.100664459

5FranceEUR

0.100664459

 

I would prefer if the solution would be implemented using Power BI, and if through Power Query then avoiding M code unless it's inevitable. 

 

Thanks a lot!

 

Jonathan

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @jonoren ;

The relationship as follow:

AilsaTao_0-1660890423240.png

Then create a measure.

 

Measure = STDEVX.S(SUMMARIZE('ExchangeRate',[CountryDate],[CurrencyCode],'ExchangeRate'[Value]),[Value])

 

The final show:

AilsaTao_1-1660890466371.png


Best Regards,
Community Support Team _ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @jonoren ;

The relationship as follow:

AilsaTao_0-1660890423240.png

Then create a measure.

 

Measure = STDEVX.S(SUMMARIZE('ExchangeRate',[CountryDate],[CurrencyCode],'ExchangeRate'[Value]),[Value])

 

The final show:

AilsaTao_1-1660890466371.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dhacd
Resolver III
Resolver III

Hi @jonoren  Can you confirm whether the records in the country table are distinct or not?
Regards,
Atma.

jonoren
Frequent Visitor

I just edited the question to reflect they are not distinct

Hi @jonoren  Please check whether you are using the countryside from the country table and the country from the exchange table are used to create a relation.

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

Thanks and Regards,
Atma.

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.