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
LRiley
Frequent Visitor

VAR/Return Measure over time

Hi, 

 

I'm hoping someone can help with this one, I have calculated the variance between the total and each row to show the impact on the overall calculation as below

LRiley_0-1594677576989.png

 This has worked perfectly when you select one date/period on the column 

 

LRiley_1-1594677676110.png

when I select more than on date period in the column the calculations are no longer correct 

 

Capture.PNG

Any help would be appreciated 

 

Thanks 

Liam

 
 

 

 

 

 

 

1 ACCEPTED SOLUTION
LRiley
Frequent Visitor

Hi, I have solved the issue using all except, as below 

NPS_Impact = 

VAR Prom =
      [NPS_PRO] - CALCULATE ( [NPS_PRO],  ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case]))
VAR Det =
      [NPS_DET] - CALCULATE ( [NPS_DET],  ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case])) 
VAR Survey =
     [NPS Surveys] - CALCULATE ( [NPS Surveys], ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case]))
VAR NPS =
    CALCULATE([NPS %],ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case]))
RETURN
    IF ( [NPS %],NPS- DIVIDE ( Prom - Det, Survey ))    

 

Thanks again 

View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

I would first try adding the week filter back into the calculation with VALUES('Date'[WeekColumn]) into each of your CALCULATE() expressions.

 

..., ALLSELECTED('NPS_Deep_Dive'), VALUES('Date'[WeekColumn]))  // replace with your actual week column name

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi Pat,

 

Thanks for the quick reply and the suggestion, I have tried several variations of adding a date to the filter, as I thought All Selected would remove the filter across the date columns also. however, I only get the NPS score for the NPS_Impact calculation

 

NPS_Impact = 

VAR Prom =
      [NPS_PRO] - CALCULATE ( [NPS_PRO], ALLSELECTED ( 'NPS_DEEP_DIVE' ), VALUES('NPS_DEEP_DIVE'[WeekStart_Case]) ) 
VAR Det =
      [NPS_DET] - CALCULATE ( [NPS_DET], ALLSELECTED ( 'NPS_DEEP_DIVE' ) , VALUES('NPS_DEEP_DIVE'[WeekStart_Case])  )  
VAR Survey =
     [NPS Surveys] - CALCULATE ( [NPS Surveys], ALLSELECTED ( 'NPS_DEEP_DIVE') , VALUES('NPS_DEEP_DIVE'[WeekStart_Case])  )
VAR NPS =
    CALCULATE([NPS %],ALLSELECTED(NPS_DEEP_DIVE),VALUES('NPS_DEEP_DIVE'[WeekStart_Case]) )
RETURN
    IF ( [NPS %],NPS- DIVIDE ( Prom - Det, Survey ))

 

I'm sure it will be something very simple and easy to correct, I have just looked at it for too long. 

 

 

LRiley
Frequent Visitor

Hi, I have solved the issue using all except, as below 

NPS_Impact = 

VAR Prom =
      [NPS_PRO] - CALCULATE ( [NPS_PRO],  ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case]))
VAR Det =
      [NPS_DET] - CALCULATE ( [NPS_DET],  ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case])) 
VAR Survey =
     [NPS Surveys] - CALCULATE ( [NPS Surveys], ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case]))
VAR NPS =
    CALCULATE([NPS %],ALLEXCEPT( 'NPS_DEEP_DIVE',NPS_DEEP_DIVE[WeekStart_Case]))
RETURN
    IF ( [NPS %],NPS- DIVIDE ( Prom - Det, Survey ))    

 

Thanks again 

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.