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

MaxDate per Value

Hi everyone,

 

I am bit in a challenge. I am receiving a table where measures a different frequencies. Some are delivered on a monthly base and some on random dates. The client like to see the most current value with the according date as an informtional attribute with it.

 

Following an example of the data structure:

 

DateOrganisationValue AValue BValue CValue D
01.01.2021

West

50205060
01.02.2021

West

30 5060
01.03.2021

West

30505060
01.04.2021

West

30 5060

 

Result:

 

For Value A,C & D the MaxDate is 01.04.2021 with the Value A=30; C=50 & D=60

 

For Value B the MaxDate is 01.03.2021 with the Value B=50

 

How can I create a measure showing me exact these values and also map the accoring attributes like Date and Organisation to it?

 

Looking forward to hear from you

 

Thanks in advance for any idea

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@BhagatRansi 

1. select date and orgnization column and unpivot other columns in PQ

1.png

2. create two measures

maxdate = MAX('Table'[Date])

Measure = MAXX(FILTER('Table','Table'[Attribute]=max('Table'[Attribute])&&'Table'[Date]=max('Table'[Date])),'Table'[Value])

2.PNG

 please see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
ryan_mayu
Super User
Super User

@BhagatRansi 

1. select date and orgnization column and unpivot other columns in PQ

1.png

2. create two measures

maxdate = MAX('Table'[Date])

Measure = MAXX(FILTER('Table','Table'[Attribute]=max('Table'[Attribute])&&'Table'[Date]=max('Table'[Date])),'Table'[Value])

2.PNG

 please see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan_mayu,

 

I still need your support the solution works so far but now I am facing the issue that when summarizing the values I am getting the Max Value of the analyzed dimension.

See in your example Value D = 60 and the Total result is also 60.

 

Is there a way to sum or to calculate the average of the values? In our case Total =47,5

 

@BhagatRansi 

you can create another measure

Measure 2 = AVERAGEX(VALUES('Table'[Attribute]),[Measure])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks a lot just figured it out last night 😅

Step by step I am getting into it

selimovd
Super User
Super User

Hey @BhagatRansi ,

 

I guess you need anyway a new measure for each Value.

The following should work:

Last Value A = CALCULATE( SUM( myTable[Value A], myTable[Date] = MAX( myTable[Date] ) )

 

Let me know if that works for you.

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Thanks for your reply this solution does not work as MAX cannot be used as filter expression in the Calculate formula

 

BhagatRansi_0-1617895115834.png

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.