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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
George375
Regular Visitor

Create a measure that only filters based on 2 fields

I have a table visual that has 7 columns from various different connected tables in PBI showing order history. I want to create a measure that shows the last time an item on a row was shipped to the customer at that same row but I want it to ignore the other columns in the visual as currently adding a max date measure only shows the date of that row and not the actual latest ship date. Any workarounds?

7 REPLIES 7
bolfri
Solution Sage
Solution Sage

Last transaction date = 
var this_order = 'Sample'[Order Number]
var this_customer = 'Sample'[Customer Number]
return CALCULATE(
    MAX('Sample'[Transaction Date]);
    'Sample'[Order Number] = this_order;
    'Sample'[Customer Number] = this_customer
)

 

Result:

bolfri_0-1671555914779.png

Is that what you meant?





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

Proud to be a Super User!




I need it to show 01.04.2022 for all as that was the last time it was shipped

Awww I am sorry, I didn't notice that. So you want a MAX(transaction date) for Customer Number?

 

Max transaction date per customer = 
var this_customer = [Customer Number]
return CALCULATE(
    MAX([Transaction Date]);
    FILTER(Tabela;[Customer Number] = this_customer)
)

 

bolfri_0-1671556627005.png

 



 

 





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

Proud to be a Super User!




This would work if all the data was from the same table. I have data from different tables that are prelinked. I tried using the related function to bypass this issue but get an error that there is no relationship in the current context.

Sorry, without sample data I can't help you. I don't know your model. I don't know your data. Dummy data with sample rows would help. With screens what you're receving and want you want to get.





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

Proud to be a Super User!




amitchandak
Super User
Super User

@George375 , Not very clear, see if these can help

Latest
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Here is an example of what my situation is. Basically I have a log of historical data with order #, transaction date, item code and customer number. I want on each line a measure that shows the latest date that item went to that customer. But becuase the order # and date field are in the visual, the measure filters only on those dates when in the table so shows the undesired dates as seen on the example table. Want to know what dax would help me get a table like my goal and not what im currently getting

Goal:

Order NumberTransaction DateItem CodeCustomer NumberLatest Date
11/1/2022ABC1231/4/2022
21/2/2022ABC1231/4/2022
31/3/2022ABC1231/4/2022
41/4/2022ABC1231/4/2022

 

What Im getting on PBI:

Order NumberTransaction DateItem CodeCustomer NumberLatest Date
11/1/2022ABC1231/1/2022
21/2/2022ABC1231/2/2022
31/3/2022ABC1231/3/2022
41/4/2022ABC1231/4/2022

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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