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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ana-pierola
Frequent Visitor

IF/SWITCH measure performance

Hi,

 

I have a general question about the best way to write if/switch measures. Is any of the following examples (1 and 2) more efficient than the other?

 

1)

if_measure = 
IF(condition_measure = value1, [measure1], [measure2])

switch_measure = 
SWITCH(condition_measure,
value1, [measure1],
value2, [measure2],
[measure3])

 

2)

if_measure = 
IF(condition_measure = value1, DAX code for measure 1, DAX code for measure 2)

switch_measure = 
SWITCH(condition_measure,
value1, DAX code for measure 1,
value2, DAX code for measure 2,
DAX code for measure 3)

 

Thanks!

1 REPLY 1
johnt75
Super User
Super User

I don't think that there would be any performance difference between the 2 but the first versions are much easier to read and maintain so I would use them

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors