cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Day by Day change: Compere Today's value with previous day

Hi,

I created a measure to calcute percentage. Requirment is to obtain Today's and previous days value. Which will be compared to show trend.

Thank you.

2 ACCEPTED SOLUTIONS
Super User

@atiftanveer

``````Change % =
VAR __CurrentValue = [Measure]
VAR __PrevDateValue =
CALCULATE ( [Measure], OFFSET ( -1, ALLSELECTED ( TABLE[Date] ) ) )
RETURN
DIVIDE ( __CurrentValue - __PrevDateValue, __PrevDateValue )``````
Did I answer your question? Mark my post as a solution! and hit thumbs up
Frequent Visitor

Hi @Fowmy

Happy New Year. I resume work on this after vacation. I acheive my goal by creating an Rank on date and used it in measure as filter:

1.  DateRank = RANKX(DimDate,DimDate[Date],,DESC)
2. mMaxDayTotalOper___Occu = CALCULATE(
DIVIDE(
CALCULATE (SUM(v___Surge[___Pat]),DimDate[DateRank]=1),
CALCULATE (SUM(v__Surge[Operational__]),DimDate[DateRank]=1)
),REMOVEFILTERS())
3.
mPreviousDayTotalOper__Occu = CALCULATE(
DIVIDE(
CALCULATE(SUM(v___Surge[___Pat]),DimDate[DateRank]=2),
CALCULATE(SUM(v___Surge[Operational__]),DimDate[DateRank]=2 )
),REMOVEFILTERS())

REMOVEFILTERS() is to remove page filters from this measrue.

Appreciate your help, I might not able to apply your solution correctly.

Regards

4 REPLIES 4
Super User

@atiftanveer

``````Change % =
VAR __CurrentValue = [Measure]
VAR __PrevDateValue =
CALCULATE ( [Measure], OFFSET ( -1, ALLSELECTED ( TABLE[Date] ) ) )
RETURN
DIVIDE ( __CurrentValue - __PrevDateValue, __PrevDateValue )``````
Did I answer your question? Mark my post as a solution! and hit thumbs up
Frequent Visitor

Hi Fowmy,

I appreciate you spare you time to look in to it. You suggestion work fine for totals. My requirement is to get percentage of today which is 72.95% and yesterday which is 63.93% then I will calculate the differnce  (Today - Yesterday).

Regards

Super User

@atiftanveer

I hope that is what exactly the measure that I shared works.

Did I answer your question? Mark my post as a solution! and hit thumbs up
Frequent Visitor

Hi @Fowmy

Happy New Year. I resume work on this after vacation. I acheive my goal by creating an Rank on date and used it in measure as filter:

1.  DateRank = RANKX(DimDate,DimDate[Date],,DESC)
2. mMaxDayTotalOper___Occu = CALCULATE(
DIVIDE(
CALCULATE (SUM(v___Surge[___Pat]),DimDate[DateRank]=1),
CALCULATE (SUM(v__Surge[Operational__]),DimDate[DateRank]=1)
),REMOVEFILTERS())
3.
mPreviousDayTotalOper__Occu = CALCULATE(
DIVIDE(
CALCULATE(SUM(v___Surge[___Pat]),DimDate[DateRank]=2),
CALCULATE(SUM(v___Surge[Operational__]),DimDate[DateRank]=2 )
),REMOVEFILTERS())

REMOVEFILTERS() is to remove page filters from this measrue.

Appreciate your help, I might not able to apply your solution correctly.

Regards

Announcements

#### Power BI Monthly Update - July 2024

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

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors