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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
giogio
New Member

Data comparison over time

Hello All!
I am struggling with the following problem: I have two tables representing listing of items at two different timeframes (Year 1 and Year 2). Every item is unique and represented by a serial number [ID] column and a location (the country is the column [Geo]).
Each table have ID and Geo columns, but the two tables have different number of rows as some items have been added and some have been removed.
The aim of my analisys is to trace (keeping the possibility to drill down the data to the "history" of the single ID): 
1. Changes in the "fleet": number of IDs added in Year 2, number of ID removed in Year 2, number of ID present in both years;
2. Changes in the location of the IDs that are present in both years (if any), locations where new items (year 2) have been introduced, locations where items have been retired.

Furthermore, I have to represent those information with a chart - I was thinking at chord chart, but should you have any suggestion I am very open to them!
Many thanks!

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @giogio ,

 

You could merge these two tables with "full outer" mode.

Then use three measures to get the results.

FLOWS =
VAR a =
    SELECTEDVALUE ( Merge1[FROM] )
VAR b =
    SELECTEDVALUE ( Merge1[TO] )
RETURN
    IF (
        a <> BLANK (),
        IF ( b = BLANK (), "RETIREMENTS", IF ( a = b, "SAME", "CHANGE" ) ),
        "NEW"
    )
# =
CALCULATE (
    COUNT ( Merge1[Custom] ),
    ALLEXCEPT ( Merge1, Merge1[FROM], Merge1[TO] )
)
DETAIL = 
CONCATENATEX(Merge1,Merge1[Custom],",")

Here is my test file for your reference.

 

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

View solution in original post

5 REPLIES 5
v-eachen-msft
Community Support
Community Support

Hi @giogio ,

 

You could merge these two tables with "full outer" mode.

Then use three measures to get the results.

FLOWS =
VAR a =
    SELECTEDVALUE ( Merge1[FROM] )
VAR b =
    SELECTEDVALUE ( Merge1[TO] )
RETURN
    IF (
        a <> BLANK (),
        IF ( b = BLANK (), "RETIREMENTS", IF ( a = b, "SAME", "CHANGE" ) ),
        "NEW"
    )
# =
CALCULATE (
    COUNT ( Merge1[Custom] ),
    ALLEXCEPT ( Merge1, Merge1[FROM], Merge1[TO] )
)
DETAIL = 
CONCATENATEX(Merge1,Merge1[Custom],",")

Here is my test file for your reference.

 

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

Thank you very much @v-eachen-msft !
As the tables contained much more information I also used some conditional formatting column iterations in the edit queries tab with great results!

Question on this: is there something similar but more flexible than chords visuals? It's fine but maybe you have in mind something more useful to show these data in a visual form.

 

Thanks again!

v-eachen-msft
Community Support
Community Support

Hi @giogio ,

 

Could you please share your sample data and excepted result to me if you don't have any confidential Information. Please upload your files to One Drive and share the link here.

 

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

@v-eachen-msft thank you for your interest!
Unfortunately my dataset is confidential, but I created an easy example (which much less entries) to better explain my problem.

I have two tables, let's call them Year1 and Year2 made of 2 columns each (ID and Location). ID represent a unique element that may be present in Year 1, Year 2 or both. The example dataset is in the picture below:

Data.JPG

My goal is to compare the two tables highlighting the dynamics happened from year 1 to year 2 in relation with ID and Location. In the picture below I'm sharing the type of results I want to achieve (divided in two levels):

1) General Analysis (left side): How many additions, how many confirmation and how many retirements from year 1 to year 2; and for the confirmed items how many has changed location and how many have kept it. While doing so, I'd like to be able to drill down to IDs of the items.

2) Flows (right side): Visualize the changes in Location associated to the items, again being able to drill down to the single ID.

Results.JPG

 

 

 

 

 

 

 

 

 

 

 

 

I hope this simple example clarifies a little bit my question. Of course I am also thinking about a graphical way to represent those data in a clear way (chord visual?)

Thanks for the help you may be able to give me!!

amitchandak
Super User
Super User

You should try using three functions in the formula except, intersect and union as per need

 

https://docs.microsoft.com/en-us/dax/except-function-dax

https://docs.microsoft.com/en-us/dax/intersect-function-dax

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.