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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
arzukari
Frequent Visitor

Very Slow DAX query

I need help with the below query:

 

MRN Diff EID:=

var __EID = CALCULATETABLE(SUMMARIZE(table1,table1[FACILITY_MRN], "Distinct EID",DISTINCTCOUNTNOBLANK(table1[EID])),
COVID[EID_Check]<>"EID Not Available")

return

SUMX(FILTER(__EID,[Distinct EID]>1),1)

The idea was to count how many people have multiple sub ids (EID) for their main ID (MRN).


The measure works great. But when added to a visual with the date as the axis, it becomes incredibly slow. any advice on how to tune the above query?

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @arzukari 

Try

MRN Diff EID :=
VAR __EID =
    FILTER (
        DISTINCT ( table1[FACILITY_MRN] ),
        CALCULATE (
            DISTINCTCOUNTNOBLANK ( table1[EID] ),
            COVID[EID_Check] <> "EID Not Available"
        ) > 1
    )
RETURN
    COUNTROWS ( __EID )

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

Hi @arzukari 

Try

MRN Diff EID :=
VAR __EID =
    FILTER (
        DISTINCT ( table1[FACILITY_MRN] ),
        CALCULATE (
            DISTINCTCOUNTNOBLANK ( table1[EID] ),
            COVID[EID_Check] <> "EID Not Available"
        ) > 1
    )
RETURN
    COUNTROWS ( __EID )

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

arzukari
Frequent Visitor

This is amazing. It is so much faster now, thank you.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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