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
Bromley
Regular Visitor

Need some help to get started (compare data between dates with multiple values)

Hi i am stuck with some data does not feel optimal for power bi. i am having some trouble when i try and do anything with the data. I am pretty new to power bi and need some help to see in what direction i should look for information.

In my data here if i would want to take my "New users " under metric_name and remove the amount of "churn" to see how the diffrence for every day how should i go about?

 

 

metric_datesitesubscription_typesubscription_durationmetric_namemetric_valuets
2018 2 01SEgross users614562018-05-10 10:25
2018 2 01SEgross Churn1532018-05-10 10:25
2018 2 01SEgross New users3252018-05-10 10:24
2018 2 01DEgross users199952018-05-10 10:25
2018 2 01DEgross Churn532018-05-10 10:25
2018 2 01DEgross New users1122018-05-10 10:24
2018 2 01NOgross users524682018-05-10 10:25
2018 2 01NOgross Churn802018-05-10 10:24
2018 2 01NOgross New users2472018-05-10 10:24
2018 2 02SEgross users609242018-05-10 10:25
2018 2 02SEgross Churn1072018-05-10 10:24
2018 2 02SEgross New users3292018-05-10 10:23
2018 2 02DEgross users198272018-05-10 10:25
2018 2 02DEgross Churn352018-05-10 10:24
2018 2 02DEgross New users822018-05-10 10:23
2018 2 02NOgross users522372018-05-10 10:25
2018 2 02NOgross Churn622018-05-10 10:24
2018 2 02NOgross New users1932018-05-10 10:23
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Bromley,

 

You can use below measure to calculate diff between two date:

Diff = 
VAR _name =
    SELECTEDVALUE ( Table1[metric_name] )
VAR _currentDate =
    MAX ( Table1[metric_date] )
VAR _previousDate =
    MAXX (
        FILTER (
            ALLSELECTED ( Table1 ),
            [metric_name] = _name
                && [metric_date] < _currentDate
        ),
        [metric_date]
    )
RETURN
    IF (
        _previousDate <> BLANK (),
        CALCULATE (
            SUM ( Table1[metric_value] ),
            Table1[metric_date] = _currentDate,
            VALUES ( Table1[metric_name] )
        )
            - CALCULATE (
                SUM ( Table1[metric_value] ),
                Table1[metric_date] = _previousDate,
                VALUES ( Table1[metric_name] )
            )
    )

7.PNG

 

Regards,

Xiaoxin Sheng

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

View solution in original post

2 REPLIES 2
Bromley
Regular Visitor

Thanks for the help. I ended upp with re-sorting the data so it would come in separate columns instead, il give it a new go when i have learnt some more about the tools.

v-shex-msft
Community Support
Community Support

Hi @Bromley,

 

You can use below measure to calculate diff between two date:

Diff = 
VAR _name =
    SELECTEDVALUE ( Table1[metric_name] )
VAR _currentDate =
    MAX ( Table1[metric_date] )
VAR _previousDate =
    MAXX (
        FILTER (
            ALLSELECTED ( Table1 ),
            [metric_name] = _name
                && [metric_date] < _currentDate
        ),
        [metric_date]
    )
RETURN
    IF (
        _previousDate <> BLANK (),
        CALCULATE (
            SUM ( Table1[metric_value] ),
            Table1[metric_date] = _currentDate,
            VALUES ( Table1[metric_name] )
        )
            - CALCULATE (
                SUM ( Table1[metric_value] ),
                Table1[metric_date] = _previousDate,
                VALUES ( Table1[metric_name] )
            )
    )

7.PNG

 

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
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.