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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sibe123
Regular Visitor

Max Value per ID by Currency - DAX Issue

Hello!

 

I want to determine a value (Amount) based on the maximum date (Valid From). The measure should be exerminable per ID and per Currency.

 

Table 1:

IDNameCurrency
1Example 1 EUR
2Example 2USD
3Example 3EUR

 

Table 2:

IDValid FromAmount
101.01.201010
101.01.201720
101.01.202030
201.01.201015
201.05.201725
301.01.20108

 

Tables are connected in 1:n via ID.

 

I have two visuals, one per Currency (Table 1) and one per ID (Table 1/2). Ideally I want to use the same measure to get: the "current" Amount of Table 2. 

So if the Slicer is set to e.g. 01.04.2017 I want to Have:

Visual 1 (per ID):

  • For ID 1: 20
  • For ID 2: 15
  • For ID 3: 8

and Visual 2 (per Currency):

  • For EUR the Sum of 1 + 3 (both EUR): 28
  • For USD the Sum of 2: 15

 

I was able to create following measure in Table 2:

 

 

 

 

Current Amount = 
VAR TargetDate = MAX(table2[Valid From])
RETURN
CALCULATE(MAX(table2[Amount]),FILTER(table2,table2[Valid From] = TargetDate))

 

 

 

 

This works for Visual 1, but not for 2. I dont know how I should sum up. I tried SUMX, DISTINCT, VALUES, and so on ... but I'm not lucky.

 

Is it possible to create one measure (or at least two) to achieve this?

 

Thank you very much! 🙂

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @sibe123 

please try

Current Amount =
SUMX (
VALUES ( Table1[ID] ),
MAXX (
TOPN ( 1, CALCULATETABLE ( Table2 ), Table2[Valid From] ),
Table2[Amount]
)
)

View solution in original post

2 REPLIES 2
sibe123
Regular Visitor

Thank you very much @tamerj1 ! You are my todays hero :)!

tamerj1
Super User
Super User

Hi @sibe123 

please try

Current Amount =
SUMX (
VALUES ( Table1[ID] ),
MAXX (
TOPN ( 1, CALCULATETABLE ( Table2 ), Table2[Valid From] ),
Table2[Amount]
)
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.