cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
jkapso751
Helper I
Helper I

General questions on CALCULATE

Hi all,

I have two (hopefully easy) general questions on best practices for newbies when using a CALCULATE function:

1. Is it better to use a column reference or a measure as a first argument?  Just wondering, because you have to consider another layer of context transition when referencing a measure (and I'd like to keep things as simple as possible).

=CALCULATE([Measure1],...

=CALCULATE(sum('DATA'[Amount]),...

 

2. What, if any, is the difference between the following two expressions?

=CALCULATE(sum('DATA'[Amount]),...

=CALCULATE('DATA'[Sum of Amount],...

 

As always, many thanks!

JK

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

1. Those are equivalent, but it is best practice to re-use existing measures if possible.

 

2. The first is a valid expression while the second will give an error in a measure due to the naked column reference.

 

Pat

Microsoft Employee

View solution in original post

2 REPLIES 2
jkapso751
Helper I
Helper I

Hi Pat,

Thanks for the feedback; appreciate your help.

For #2, the function was calculating an amount.  Maybe the [Sum of Amount] was an implicit measure?  Not sure.  Nevertheless, I did change my DAX formulas to match the first expression.

 

Best regards,

John K.

ppm1
Solution Sage
Solution Sage

1. Those are equivalent, but it is best practice to re-use existing measures if possible.

 

2. The first is a valid expression while the second will give an error in a measure due to the naked column reference.

 

Pat

Microsoft Employee

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors