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.
Hello,
I am trying to calculate the difference between the first value selected and last value in the trend line. I was able to achieve that for daily trend. In the picture below. the metric Positive Sentiment Increased by 11% (83% - 72%). Similarly, I would like to do for weekly trend (picture attached below), the metric should display (81%-77% = 4%) and for monthly trend (picture attached below), it should display (82%-79%=3%).
the formula used for daily trend is:
difference % Positive =
var startdate = [Start date]
var start_pct=
CALCULATE([% Positive],
FILTER(ALL('Date'[Time Period]),'Date'[Time Period]=startdate))
var enddate = [End date]
var end_pct=
CALCULATE([% Positive],
FILTER(ALL('Date'[Time Period]),'Date'[Time Period]=enddate))
return ABS(end_pct - start_pct)
Solved! Go to Solution.
Hi @PoojaG ,
We can try to use the following measure to get Monthly Diff percentage:
Monthly difference % Positive =
VAR startdate =
YEAR ( [Start date] ) * 100
+ MONTH ( [Start date] )
VAR start_pct =
CALCULATE (
[% Positive],
FILTER (
ALL ( 'Date'[Time Period] ),
YEAR ( [Time Period] ) * 100
+ MONTH ( [Time Period] ) = startdate
)
)
VAR enddate =
YEAR ( [End date] ) * 100
+ MONTH ( [End date] )
VAR end_pct =
CALCULATE (
[% Positive],
FILTER (
ALL ( 'Date'[Time Period] ),
YEAR ( [Time Period] ) * 100
+ MONTH ( [Time Period] ) = enddate
)
)
RETURN
ABS ( end_pct - start_pct )
Best regards,
Hi @PoojaG ,
How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?
Best regards,
Hi @PoojaG ,
We can try to use the following measure to get Monthly Diff percentage:
Monthly difference % Positive =
VAR startdate =
YEAR ( [Start date] ) * 100
+ MONTH ( [Start date] )
VAR start_pct =
CALCULATE (
[% Positive],
FILTER (
ALL ( 'Date'[Time Period] ),
YEAR ( [Time Period] ) * 100
+ MONTH ( [Time Period] ) = startdate
)
)
VAR enddate =
YEAR ( [End date] ) * 100
+ MONTH ( [End date] )
VAR end_pct =
CALCULATE (
[% Positive],
FILTER (
ALL ( 'Date'[Time Period] ),
YEAR ( [Time Period] ) * 100
+ MONTH ( [Time Period] ) = enddate
)
)
RETURN
ABS ( end_pct - start_pct )
Best regards,
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
2 | |
2 | |
1 | |
1 |