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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Samcooke
Frequent Visitor

Still can't figure out level of detail for max date

I am still struggling with the Power BI Version of level of details so I am hoping for some help. I have the below data set where I have instrument kits that have gone out to surgery on 4 different dates. I only want to display the most recent date (10/8/2021). So in the below example there would be a single row showing Branch_Id, Kit_Instance_Id and Case_Surgery_Date

 

Data SetData Set

When I try to write DAX for a new measure using the below, it does not work

Max Surgery Date = CALCULATE(MAX(TBL_CASE[Case_Surgery_Date]), ALLEXCEPT(TBL_KIT_INSTANCE, TBL_KIT_INSTANCE[Kit_Instance_Id]))
 
I get this where it is giving me the same date of each row
Max Date 2.JPG
What am I doing wrong? Should I not be using DAX for this?
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Samcooke,

Perhaps you can try to use the following measure formula if helps:

Max Surgery Date =
CALCULATE (
    MAX ( TBL_CASE[Case_Surgery_Date] ),
    ALLSELECTED ( TBL_KIT_INSTANCE ),
    VALUES ( TBL_KIT_INSTANCE[Kit_Instance_Id] )
)

If you are not so clear about row and filter context, you can also take a look at the following blog:

Row Context and Filter Context in DAX - SQLBI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Samcooke,

Perhaps you can try to use the following measure formula if helps:

Max Surgery Date =
CALCULATE (
    MAX ( TBL_CASE[Case_Surgery_Date] ),
    ALLSELECTED ( TBL_KIT_INSTANCE ),
    VALUES ( TBL_KIT_INSTANCE[Kit_Instance_Id] )
)

If you are not so clear about row and filter context, you can also take a look at the following blog:

Row Context and Filter Context in DAX - SQLBI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
lbendlin
Super User
Super User

might be a simple issue with the data model.

 

Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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