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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Simplifying dax query with iteration that caused performance issue

Hi All, My PBI reports are working just fine but the problem is, it's having performance issue in my actual pbi, loading takes too much of time. But in my mockup pbi it's working fine. i think this is due to long queries of the dax measures. 

 

Two measure that's needing simplifications

1. 

Status expected measure: =
VAR _latestdate =
    CALCULATE (
        MAX ( Student[Application Date] ),
        ALLEXCEPT ( Student, Student[Student ID] )
    )
VAR _maxstatuskey =
    MAXX (
        FILTER (
            ALL ( Student ),
            Student[Student ID] = MAX ( Student[Student ID] )
                && Student[Application Date] = _latestdate
        ),
        Student[Application Status Key]
    )
RETURN
    IF (
        HASONEVALUE ( Student[Student ID] ),
        CALCULATETABLE (
            VALUES ( 'Status'[Status] ),
            'Status'[Application Status Key] = _maxstatuskey
        )
    )
 
 
2. 
Application date measure: =
VAR _latestdate =
    CALCULATE (
        MAX ( Student[Application Date] ),
        ALLEXCEPT ( Student, Student[Student ID] )
    )
RETURN
IF( HASONEVALUE(Student[Student ID]),
    _latestdate)
 
Mockup result which is correct:

ameng_0-1660066280539.png

pbi file 

I need to apply the same logic from the mockup pbi to my actual pbi and it's having performance issues, and i believe this is due to the long dax queries.Hoping that someone can guide me on this, thank you!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , seem like you need latest value. Only create one measure and try to use that visual level filter

 

refer to my code

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , seem like you need latest value. Only create one measure and try to use that visual level filter

 

refer to my code

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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