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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rcamatchee
Regular Visitor

How to create variance field and variance

 

Matrix report.pngRelationship.PNG 

 

Hi Guys,

I have created three tables Actsales, BdtSales and LYSales that contains duplicates as they relate to sales transactions for actuals, last year compared to budget.  I have indeirectly link them by creating dimension tables.

Although, I have created a nice matrix, yet I'm unable to create variance columns e.g Actual v Budget and Actual v Last year as well.

Can you show me the way, thank you

Regards

Rama Camatchee


   
 
   
     
   
   
     
       
 
 
 


     
   
 
 
   
     
   
   
     
   
 


 

 

 

 

 

 

 

 

 

 

 

5 REPLIES 5
v-shex-msft
Community Support
Community Support

Hi @rcamatchee,

 

For your requirement, you can try to use filter to extract related number list and use 'VARX.P' function to calculate with extracted list.

 

Sample measure:

Variance Measure =
VAR budSales =
    CALCULATETABLE (
        VALUES ( budSales[BdtSales] ),
        'use relationship to filtler budsales table'
    )
VAR actSales =
    CALCULATETABLE (
        VALUES ( actSales[ActSales] ),
        'use relationship to filtler actSales table'
    )
VAR lyactSales =
    CALCULATETABLE (
        VALUES ( lyactSales[LYSales] ),
        'use relationship to filtler lyactSales table'
    )
RETURN
    VARX.P ( UNION ( budSales, actSales, lyactSales ), [BdtSales] )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin Sheng,

 

Thank you.

 

I have created a new measure under matrix and inserted the DAX, but it returns an error despite that I have properly linked the three tables under dimtables.

 

Kindly assist.

 

Regards

Rama BudVar.PNG

Hi @rcamatchee,

 

These error part need to be replaced with your own filters to use current item to get related table records.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin Sheng,

 

What do you mean by  own filters can you give me an example.

 

At the moment, I don't need any filters.

 

Please note that you have correctly inserted the field names in the DAX script

 

Regards

Rama Camatchee

 

Hi @rcamatchee,

 

For example, your visualization is based on salesperson column and related sales from three different tables, you can modify formula like below:

Variance Measure =
VAR _budSales =
    CALCULATETABLE (
        VALUES ( 'budSales'[BdtSales] ),
        VALUES ( 'Salesperson_Dim'[Salesperson] )
    )
VAR _actSales =
    CALCULATETABLE (
        VALUES ( 'actSales'[ActSales] ),
        VALUES ( 'Salesperson_Dim'[Salesperson] )
    )
VAR _lyactSales =
    CALCULATETABLE (
        VALUES ( 'lyactSales'[LYSales] ),
        VALUES ( 'Salesperson_Dim'[Salesperson] )
    )
RETURN
    VARX.P ( UNION ( _budSales, _actSales, _lyactSales ), [BdtSales] )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.