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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Prakash_A
New Member

Difference between two variable data

Hi all i am new to PowerBI kindly help if you have any idea

I have a data set as shown below. I want to be able to select two versions data and get their difference and group that difference into 3 segments then plot them in a graph. For example i want to compare version A1 with version A6 and get the difference and group them if possible and plot them in the graph. The selection of version should be variable. Thank you in advance.

Sample Data Set - 

 

ProductMonthVersionX
AppleJul 2024A13000
AppleJul 2024A22000
AppleJul 2024A34000
AppleJul 2024A43400
AppleJul 2024A55400
AppleJul 2024A64300
AppleJul 2024A73200
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Prakash_A 

 

Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1707969704080.png

 

Measure:

Diff =

VAR _version1 =

    SELECTEDVALUE ( Version1[Version1] )

VAR _version2 =

    SELECTEDVALUE ( Version2[Version2] )

VAR _version1Value =

    CALCULATE (

        MAX ( 'Table'[X] ),

        FILTER ( 'Table', 'Table'[Version] = _version1 )

    )

VAR _version2Value =

    CALCULATE (

        MAX ( 'Table'[X] ),

        FILTER ( 'Table', 'Table'[Version] = _version2 )

    )

RETURN

    IF (

        _version1Value >= _version2Value,

        _version1Value - _version2Value,

        _version2Value - _version1Value

    )

If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @Prakash_A 

 

Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1707969704080.png

 

Measure:

Diff =

VAR _version1 =

    SELECTEDVALUE ( Version1[Version1] )

VAR _version2 =

    SELECTEDVALUE ( Version2[Version2] )

VAR _version1Value =

    CALCULATE (

        MAX ( 'Table'[X] ),

        FILTER ( 'Table', 'Table'[Version] = _version1 )

    )

VAR _version2Value =

    CALCULATE (

        MAX ( 'Table'[X] ),

        FILTER ( 'Table', 'Table'[Version] = _version2 )

    )

RETURN

    IF (

        _version1Value >= _version2Value,

        _version1Value - _version2Value,

        _version2Value - _version1Value

    )

If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 

 

Hi, thank you for the solution . the solution is somewhat of what i wanted but i want to know if this data can be populated into a column for further analysis and all. but thanks for this method

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.