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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sorg
New Member

Total newbie need some help.

Hi,

I am a total beginner.

I am starting to tinker a little bit with power BI in order to create some KPI for my job, but i am struggling a little bit.

Here is my current issue.

 

I have a table in which i have a reccord of all the quotation issued by my company. The simplified structure of this table is as follows:

date       idProject idVersion netPrice
01/02/2018 0001 10 1111
18/06/2018 0001 20 2222
21/06/2019 0001 30 3333
30/08/2019 0002 10 4444
30/09/2019 0002 20 5555

I want to create a report that display , for a given period, the list of the sent quotation keeping only the latest version of each project in the given period.

 

For exemple, if i filter on 2018, i expect to see:

date idProject idVersion netPrice
18/06/2018 0001 20 2222

if i filter on 2019, i expect to see:

date idProject idVersion netPrice
21/06/2019 0001 30 3333
30/09/2019 0002 20 5555

I have imported my table in power BI, and i started creating a report.

I have a filter that allow to select the period. It work as expected.

I have created a "table display" with the following values: date, idProject and a quick measure making the following calculation:

lastIdVersionInThePeriod = 
MAXX(
KEEPFILTERS(VALUES('Table'[idProject]));
CALCULATE(MAX('Table'[idVersion ]))
)

 

it works quite well, and i get this (if i filter on 2019):

 

date idProject idVersion
21/06/2019 0001 30
30/09/2019 0002 20

If i add the netPrice value in the table, it does not work anymore, and it will display all the version in the period (not only the last one)

I suspect, i am not doing it properly, 

Can someone point me in the right direction ?

1 ACCEPTED SOLUTION

@sorg try this measure 

 

Measure = 
VAR __id = MAX ( 'Table'[id] )
VAR __date = CALCULATE ( MAX( 'Table'[date] ), ALLSELECTED ( 'Table' ),  'Table'[id] = __id ) 
RETURN CALCULATE ( MAX ( 'Table'[netprice] ), VALUES ( 'Table'[id] ), 'Table'[id] = __id, 'Table'[date] = __date )

 

and you will get this output.

 

Would appreciate Kudos 🙂 if my solution helped.

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Add a desc rank based on the project and date. And the filter on rank =1

Refer

https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I tried, but could not use your solution. At some point i have an error message because idVersion is not unique and i don't aggregate the values. 

@sorg try this measure 

 

Measure = 
VAR __id = MAX ( 'Table'[id] )
VAR __date = CALCULATE ( MAX( 'Table'[date] ), ALLSELECTED ( 'Table' ),  'Table'[id] = __id ) 
RETURN CALCULATE ( MAX ( 'Table'[netprice] ), VALUES ( 'Table'[id] ), 'Table'[id] = __id, 'Table'[date] = __date )

 

and you will get this output.

 

Would appreciate Kudos 🙂 if my solution helped.

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thank you @parry2k , i appreciate your help. it works !

Could you explain step by step what your measure do ? I would like to understand the innerworking.

 

Kind regards.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.