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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rautaniket0077
Resolver I
Resolver I

show icons based on previous value of measure

Hi Team,

As you can see in the attached image my data is having rules, monday date representing the week ( for eg:- Week of 14-Oct) and score, i need to show the icons comparing current score with previous score but there are some weeks when rules are not executed for those weeks i need to show "-", now the case when previous value is "-" then compare current value with previous non hyphen "-" value.
Note -

1) score is the measure and it is calculated as (total records - bad records) *100/ total records 

2) you can use the sort column to sort the Week Monday

data-

RuleWeek MondayTotal RecordsBad RecordsSort
AWeek of 30-Sep100101
BWeek of 30-Sep9081
CWeek of 30-Sep80201
AWeek of 07-Oct  2
BWeek of 07-Oct5022
CWeek of 07-Oct  2
AWeek of 14-Oct9053
BWeek of 14-Oct70253
CWeek of 14-Oct20063
AWeek of 23-Sep30050
BWeek of 23-Sep30100
CWeek of 23-Sep40080

 

 

 

rautaniket0077_0-1729148585863.png

 

5 REPLIES 5
rautaniket0077
Resolver I
Resolver I

Hi @lbendlin , @Greg_Deckler , @bhanu_gautam please help me here. 

rautaniket0077
Resolver I
Resolver I

Hi @bhanu_gautam ,

Thank you for the reply, here the score is not column its a measure and when i am trying to calculate the previous score its giving me the blank and one more thing i need to show the data for the last 7 weeks only so one date filter is applied on this matrix vasual.  

@rautaniket0077 , Try updated one to handle blanks

 

Create a measure to compute the score:

Score =
IF(
ISBLANK(SUM('Table'[Total Records])) || ISBLANK(SUM('Table'[Bad Records])),
BLANK(),
(SUM('Table'[Total Records]) - SUM('Table'[Bad Records])) * 100 / SUM('Table'[Total Records])
)

 

Create a measure to get the previous non-hyphen score:

Previous Score =
VAR CurrentSort = MAX('Table'[Sort])
VAR CurrentRule = MAX('Table'[Rule])
RETURN
CALCULATE(
[Score],
FILTER(
'Table',
'Table'[Sort] < CurrentSort &&
'Table'[Rule] = CurrentRule &&
NOT(ISBLANK([Score]))
),
LASTNONBLANK('Table'[Sort], [Score])
)

 

Create a measure to compare the current score with the previous score and display the appropriate icon:

Score Comparison Icon =
VAR CurrentScore = [Score]
VAR PrevScore = [Previous Score]
RETURN
IF(
ISBLANK(CurrentScore),
"-",
SWITCH(
TRUE(),
ISBLANK(PrevScore), "-",
CurrentScore > PrevScore, "↑",
CurrentScore < PrevScore, "↓",
"→"
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam ,

so sort (and Week of 14-Oct) is coming from date table and rules are from separate table. Apart from this there is no blanks in data but since i need to show  last 7 weeks if particular rule is not executed in that week then i need to show that week as well with "-".

bhanu_gautam
Super User
Super User

@rautaniket0077 , Try using below measures 

Create a measure to get the previous score, skipping any weeks where the score is not available:

Previous Score =
VAR CurrentWeek = MAX('Table'[Sort])
VAR PreviousWeek =
CALCULATE(
MAX('Table'[Sort]),
FILTER(
'Table',
'Table'[Sort] < CurrentWeek && NOT(ISBLANK('Table'[Score]))
)
)
RETURN
CALCULATE(
MAX('Table'[Score]),
FILTER(
'Table',
'Table'[Sort] = PreviousWeek
)
)
 
 

Create a measure to compare the current score with the previous score and display the appropriate icon:

Score Icon =
VAR CurrentScore = MAX('Table'[Score])
VAR PrevScore = [Previous Score]
RETURN
IF(
ISBLANK(CurrentScore),
"-",
SWITCH(
TRUE(),
ISBLANK(PrevScore), "-",
CurrentScore > PrevScore, "🔼", // Up arrow icon
CurrentScore < PrevScore, "🔽", // Down arrow icon
"" // Dash icon for no change
)
)

 

Add a table or matrix visual to your report and include the Week Monday, Rule, Score, and Score Icon columns/measures.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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