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
Anonymous
Not applicable

Find variance of quarter sales with previous quarter , where quarter will be selected by slicer

HI,

 

I have to display selected quarter sales by marketing unit and previous quarter sales with the variance , i am not able to find variance.

 

Note : If user will select Q1 of FY 2017-2018 than Q4 value of 2016-2017 should also be shown with the variance.

 

 

Regards

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

For variance calculation, you can choose the "variance" function to aggregate values under the list.

1.PNG

 

To display selected quarter sales and previous quarter sales, you may need to add an index column to specify the ascending order of the Year-Quarter. Also, you need an extra table to list all available selections uniquely, like below. Later, you should drag [Quarter] field from this table into slicer.

2.PNG

 

Create such a measure, add it to visual level filters and set its value to 1.

Measure =
IF (
    SELECTEDVALUE ( Table4[Index] ) = SELECTEDVALUE ( 'Slicer Table'[Index] )
        || SELECTEDVALUE ( Table4[Index] )
            = SELECTEDVALUE ( 'Slicer Table'[Index] ) - 1,
    1,
    0
)

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

For variance calculation, you can choose the "variance" function to aggregate values under the list.

1.PNG

 

To display selected quarter sales and previous quarter sales, you may need to add an index column to specify the ascending order of the Year-Quarter. Also, you need an extra table to list all available selections uniquely, like below. Later, you should drag [Quarter] field from this table into slicer.

2.PNG

 

Create such a measure, add it to visual level filters and set its value to 1.

Measure =
IF (
    SELECTEDVALUE ( Table4[Index] ) = SELECTEDVALUE ( 'Slicer Table'[Index] )
        || SELECTEDVALUE ( Table4[Index] )
            = SELECTEDVALUE ( 'Slicer Table'[Index] ) - 1,
    1,
    0
)

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Stachu
Community Champion
Community Champion

this syntax assumes that you have a calendar table marked as date table, as described here
https://www.sqlbi.com/articles/time-intelligence-in-power-bi-desktop/

Last Quarter Sales = CALCULATE([Sales], DATEADD(Calendar[Date],-1,QUARTER))
Delta Last Quarter = [Sales]-[Last Quarter Sales]

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.