Skip to main content
cancel
Showing results for 
Search instead 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

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

 

atiftanveer_0-1703256552015.png

 

Thank you.

2 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@atiftanveer 

Follow this pattern: 

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


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

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:

 

atiftanveer_1-1704828800229.png

 

  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

View solution in original post

4 REPLIES 4
Fowmy
Super User
Super User

@atiftanveer 

Follow this pattern: 

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


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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

 

atiftanveer_2-1703789152604.png

 

Regards

 

 

 

@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


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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:

 

atiftanveer_1-1704828800229.png

 

  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

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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