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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

VAR RETURN ALL

Hello everyone,

 

I have a page filter to show only current active contracts information. However, I would like to add a column to calculate total sales which includes expired contacts. Hence, I used the following formula:

 

Total Sales ALL=

VAR Active Contract Sales= CALCULATE([Total Sales],DATESBETWEEN('Calendar'[Date],date (start date)), date (end date)))
RETURN CALCULATE(Active Contract Sales, ALL('Contract Details'[Active Status]))
 
From the formula above, the result I got is without the sales from expired contract (i.e. same as the result using Active Contract Sales= CALCULATE([Total Sales],DATESBETWEEN('Calendar'[Date],date (start date)), date (end date)))

However, when i tried to separate the VAR RETURN formula into two different measures as below, i managed to get the sales from both active and expired contracts:
Measure 1= CALCULATE([Total Sales],DATESBETWEEN('Calendar'[Date],date (start date)), date (end date)))
Measure 2= CALCULATE([Measure 1], ALL('Contract Details'[Active Status]))

Anyone knows what is wrong with my VAR RETURN formula please?
 
Thank you!
1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

variance can not be used in the first parament of CALCULATE. variance only be calculated once, after calculating, its value became solid, can never be changed.

View solution in original post

3 REPLIES 3
wdx223_Daniel
Super User
Super User

variance can not be used in the first parament of CALCULATE. variance only be calculated once, after calculating, its value became solid, can never be changed.

Anonymous
Not applicable

Thanks for the reply both @wdx223_Daniel  @Anonymous  😀

Anonymous
Not applicable

Hello @Anonymous 

Could you please share the pbix file after removing the sensitive information?

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.