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
vickyprudhvi
Helper IV
Helper IV

Dax Measure Performance

Hi ,

We have 21mil rows tables and corrected to PowertBI Desktop using Direct Query method. We have created a parameter table with 7 Measure names and created a measure using swtich case to show different measures as per slicer selection(Dynamic Measure Selection). Measure is show below

 = IF (
    HASONEVALUE ( 'ViewTrend'[SelectMeasure] ),
    SWITCH (
        VALUES ( 'ViewTrend'[SelectMeasure] ),
        "Total Claims", [Claims],
        "Total Incurred", [Total Incurred Amount],
        "Medical Incurred", [Total Medical Incurred],
        "Indemnity Incurred", [Total Indemnity Incurred],
        "Total Paid", [Total Paid Amount],
        "Medical Paid", [Total Medical Paid],
        "Indemnity Paid", [Total Indemnity Paid],
        [Claims]
    ),
    [Claims]
)

But the performace of this measure is very slow and some times visual fails. I would like to know if there is a better way of writing this measure to increase the performance.

 

Thank you for your help,

Vicky

8 REPLIES 8
Greg_Deckler
Super User
Super User

That looks like the standard disconnected table trick. Not sure what you could do to improve it other than refactoring your report to not require using it.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
GilbertQ
Super User
Super User

Hi @vickyprudhvi

 

If you run the measures seperately do they run quickly?

 

I have not experienced any performance issues when using the Dynamic Measures before (Mostly been done where the data was imported into the Power BI Desktop file)





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

Proud to be a Super User!







Power BI Blog

@GilbertQ

If I use this measure against  8k rows it is fast but wen I use this measure against 20Mill it is very slow.

Hi @vickyprudhvi

 

That would indicate that the measure is not as fast as it could be. I would suggest looking at ways to improve the measure so that it returns the data faster.


Once that is done, then I am sure that the SWITCH measure would work well.





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

Proud to be a Super User!







Power BI Blog

@GilbertQ and  @Greg_Deckler

Sorry - Measure I meant here is Switch case measure.

all the measures used in the switch case are simple sum() and countrows.

independently all measures work pretty good.

I am using the switch case measure across a time period for a year (Trending Chart).

Hi @vickyprudhvi

 

Ok thanks for letting me know.

 

I am not sure why the SWITCH is so slow. My only thinking is possibly because it is built ontop of the DirectQuery connection?





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

Proud to be a Super User!







Power BI Blog

@GilbertQ

I dont think direct query will effect a measure performance so much . I woould like to know if there is any other way fo achieving this functionality without using Switch case of hasonefilter function

Are you certain that it is this SWITCH statement that is running slow versus the actual measures that are being displayed. I think that was what @GilbertQ was asking. I tend to agree with him, my suspicion would be that a simple SWITCH statement shouldn't slow things down.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors