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

Finding Difference between Two Selections

Hello everyone,

 

I am a new Power BI user and need your help.

I have a data like on the table below.  Field "Value" is a string type technically but intuitively its values are different types, it may be text, number, date or percent. 

ParameterVersionValue Variable Type
par1115 Number
par215/15/2023 Date
par310.15 Percent
par41D1 Text
par1220 Number
par226/15/2023 Date
par320.16 Percent
par42D2 Text

I have two slicer filters. One slicer - field "Version" where "1" will be selected and the second slicer again field "Version" where "2" will be selected. And I want to create table visual in Power BI where I should see the difference between the two versions of the field "Value".  So the table like below

Filter 1   Filter 2
Version -1  Version-2
     
  Frue/FalseDif 
 par1FALSE5 
 par2FALSE1 
 par3FALSE0.10% 
 par4FALSENA 

I tried to create those TRUE/FALSE and Difference measures but could not deal with it as the field "Value" has string type but intuitively its values can be date, numeric and etc. 

Could you please help how can I solve this problem?

Thank you very much

2 REPLIES 2
Alef_Ricardo_
Resolver II
Resolver II

Hello Nino1, welcome to the Power BI community! 😊

It seems like you are trying to create a table visual in Power BI that shows the difference between two versions of the field “Value” based on two slicer filters. One solution to this problem could be to create a measure that calculates the difference between the two selected versions.

One way to do this is by duplicating the table with the same records (not having a relationship) and using the new table as the source of one slicer. Then, you can use a measure to compare the difference between the two selections1. Here is an example of a measure that calculates the difference between two selections:

Diff = CALCULATE ( SUM ( Table [Amount] ), ALLSELECTED ( Table [Column] ) ) - CALCULATE ( SUM ( NTable [Amount] ), ALLSELECTED ( NTable [Column] ) )

In this example, Table and NTable are two tables with the same records, and Column is the column used in the slicer. This measure calculates the sum of the Amount column for each selection and subtracts them to find the difference.

I hope this helps! Let me know if you have any further questions. 😊

Thank you for your response! I tried to write dax code as you suggested just it did not work as the data type is string and sum functon does not work with it. 

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.