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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ekaponkratova
Frequent Visitor

Calculation when no country is selected

I have the below dataset and user country as a filter. The task is to calculate the revenue - calculated as sum paid in this month -  sum paid in the previous month. It should be calculated in USD. The solution of multiplying the exchange rate in the below table, then, creating a measure using PREVIOUSMONTH and then, doing subtraction doesn't work because of the high exchange rate fluctuation. 

12.png

The solution we came with was to calculate the revenue in the local currency. And then, if a user selects Switzerland from the filter, the revenue will be multiplied by the exchange rate for the corresponding country and corresponding date. 

2.png

Here are the formulas in practice:

Measures:
 
prior_month_sum_lc = CALCULATE(sum(fact_payment[sum_paid_to_date]),PREVIOUSMONTH(calendar_3[Date]))
 
revenue = sum(fact_payment[sum_paid_to_date])-[prior_month_sum_lc] 
 
revenue_usd = IF(SELECTEDVALUE(fact_payment[country])="Spain",
[revenue] * AVERAGEX(fact_payment,fact_payment[xr_es]),0 )
 

And it is working just fine when you select a particular country, however, I cannot a formula work when no country is selected. I've uploaded the sample at

https://drive.google.com/file/d/1ADLoDNSVBFo-G_SYj30xPH490yTDNXrL/view?usp=sharing.

 

My attempt to do the filter is in the measure final

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

Hi @ekaponkratova ,

 

To update your measure as below.

 

final_calc =
IF (
    ISFILTERED ( Sheet1[country] ) = FALSE (),
    CALCULATE (
        SUM ( Sheet1[cum sum paid] ),
        DATEADD ( 'calendar_3'[Date], -1, MONTH ),
        Sheet1[country] = "Spain"
    )
)

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @ekaponkratova ,

 

To update your measure as below.

 

final_calc =
IF (
    ISFILTERED ( Sheet1[country] ) = FALSE (),
    CALCULATE (
        SUM ( Sheet1[cum sum paid] ),
        DATEADD ( 'calendar_3'[Date], -1, MONTH ),
        Sheet1[country] = "Spain"
    )
)

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

@ekaponkratova  - You'll want to do something like SUMX(YourTable[Raw Revenue]*ExchangeRates[Rate])

Because you need to calculate the value for each day and then sum them up.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.