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
PaulShlapa
Helper I
Helper I

Cumulative rate by group in chart

Dear Experts,

 

I have a dataset that consists of two tables

 

CurrentCurrencyRates

Screenshot 2024-03-07 153943.png

 

InflationRates

Screenshot 2024-03-07 154132.png

 

I would like to use CurrentCurrencyRates as a filter table and obtain cumulative inflation rates over time for country and currency

I have a measure for cumulative inflation rates

Cumulative Inflation Rate = 
CALCULATE (
    SUM ( 'InflationRates'[Shifted Inflation Rate] ),
    ALLEXCEPT(  'InflationRates', InflationRates[CurrencyType] ),
    'InflationRates'[Year] <= MAX ( InflationRates[Year] )
)

 

The end result should look like this:

1) when Currency EUR is chosen

Screenshot 2024-03-07 154851.png

2) when Currency ARS is chosen

Screenshot 2024-03-07 154923.png

 

Filters SalesCompany and Currency come from the first table CurrentCurrencyRates and it should stay like this if possible.

At the moment however Cumulative Inflation Rate measure does react to Currency filter and the result is the same no matter which Currency i choose. It looks like it cumulates Shifted Inflation Rate irrespective of the Currency Type.

Screenshot 2024-03-07 154617.png

 

How could i improve on this?

 

Any help and suggestions are very appreciated.

 

Link to the PBIX File:

https://www.dropbox.com/scl/fi/mje5qgya6hiamcd85qszy/CumulativeCurrencyRatesTest.pbix?rlkey=y8d8q4ma...

 

Sincerely,

 

Pavlo

 

2 ACCEPTED SOLUTIONS
v-xiandat-msft
Community Support
Community Support

Hi @PaulShlapa ,

Below is my table1:

vxiandatmsft_0-1709863180180.png

Below is my table2:

vxiandatmsft_1-1709863195226.png

Since these two tables have a many-to-many relationship, a third bridged table needs to be created:

vxiandatmsft_2-1709863233872.png

Then the relationship is like this:

vxiandatmsft_3-1709863261009.png

The following DAX might work for you:

Cumulative Inflation Rate = 
// CALCULATE (
//     SUMX( InflationRates , 'InflationRates'[Shifted Inflation Rate] ),
//     // ALLEXCEPT(  'InflationRates', InflationRates[CurrencyType] ),
//     'InflationRates'[Year] <= MAX ( InflationRates[Year] )
// )
CALCULATE (
    SUM ( 'InflationRates'[Shifted Inflation Rate] ),
    FILTER(
        ALL('InflationRates'),
        'InflationRates'[Year] <= MAX ( 'InflationRates'[Year] )
        && 'InflationRates'[CurrencyType] IN VALUES ( 'CurrentCurrencyRates'[CurrencyType] )
    )
)

The final output is shown in the following figure:

vxiandatmsft_4-1709863333764.pngvxiandatmsft_5-1709863341287.png

Best Regards,

Xianda Tang

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

Hi @PaulShlapa ,

My LC is like this:

vxiandatmsft_0-1709890802918.png

The updated bridge table:

vxiandatmsft_1-1709890864924.png

Best Regards,

Xianda Tang

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
PaulShlapa
Helper I
Helper I

Very impressive @v-xiandat-msft work perfectly, many thanks

PaulShlapa
Helper I
Helper I

Thanks @v-xiandat-msft , a good approach, still it does not filter LC for another Sales Company AE, which has which has LC AED. I guess your solution with a bridge table does not consider that.

Hi @PaulShlapa ,

My LC is like this:

vxiandatmsft_0-1709890802918.png

The updated bridge table:

vxiandatmsft_1-1709890864924.png

Best Regards,

Xianda Tang

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

 

v-xiandat-msft
Community Support
Community Support

Hi @PaulShlapa ,

Below is my table1:

vxiandatmsft_0-1709863180180.png

Below is my table2:

vxiandatmsft_1-1709863195226.png

Since these two tables have a many-to-many relationship, a third bridged table needs to be created:

vxiandatmsft_2-1709863233872.png

Then the relationship is like this:

vxiandatmsft_3-1709863261009.png

The following DAX might work for you:

Cumulative Inflation Rate = 
// CALCULATE (
//     SUMX( InflationRates , 'InflationRates'[Shifted Inflation Rate] ),
//     // ALLEXCEPT(  'InflationRates', InflationRates[CurrencyType] ),
//     'InflationRates'[Year] <= MAX ( InflationRates[Year] )
// )
CALCULATE (
    SUM ( 'InflationRates'[Shifted Inflation Rate] ),
    FILTER(
        ALL('InflationRates'),
        'InflationRates'[Year] <= MAX ( 'InflationRates'[Year] )
        && 'InflationRates'[CurrencyType] IN VALUES ( 'CurrentCurrencyRates'[CurrencyType] )
    )
)

The final output is shown in the following figure:

vxiandatmsft_4-1709863333764.pngvxiandatmsft_5-1709863341287.png

Best Regards,

Xianda Tang

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

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.