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

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.

Reply
Anonymous
Not applicable

default selection to be on a card last completed month or period

Hi Gurus, 

 

I have a requirement, 

 

in the below grap KPI card visual shows the current month value by default, SelectLastMonth1.JPG

 

But I wanted to show the last completed period (this instance June) numbers on the KPI card visual. is there anyway I can achive this thoouhg visual level filers. also this needs to change the value based on the user slection (cannnot be static for last month only)

 

SelectLastMonth2.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous , @amitchandak 

 

managed to crank my head around and comeup with the working solution :).

 

Below measure fit my prupose.

 

Thanks a lot for your time.

 

Measure = 

VAR PreviousMnth =
IF(ISBLANK(SELECTEDVALUE('Date'[Month Number])),MONTH(TODAY()) - 1, SELECTEDVALUE('Date'[Month Number]))
VAR Result =
CALCULATE(
[% Safety Critical Maintenance Compliance],
FILTER(
'Date',
'Date'[Month Number] = PreviousMnth
)
)
RETURN
Result

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@Anonymous , @amitchandak 

 

managed to crank my head around and comeup with the working solution :).

 

Below measure fit my prupose.

 

Thanks a lot for your time.

 

Measure = 

VAR PreviousMnth =
IF(ISBLANK(SELECTEDVALUE('Date'[Month Number])),MONTH(TODAY()) - 1, SELECTEDVALUE('Date'[Month Number]))
VAR Result =
CALCULATE(
[% Safety Critical Maintenance Compliance],
FILTER(
'Date',
'Date'[Month Number] = PreviousMnth
)
)
RETURN
Result
amitchandak
Super User
Super User

@Anonymous , try a measure like this

measure =
var _max = if(today()= eomonth(Today(),0),Today(),eomonth(Today(),-1)) // maxx(allselected(Date),Date[Date])
var _min = eomonth(_max,-1)+1
return
calculate(Sum(Table[Column]), filter(all(Date), Date[Date]>=_min && Date[Date]<=_max))

Anonymous
Not applicable

@amitchandak ,

 

this measure does not work for me. idea is correct @Anonymous  could you please post a related measure if you have. the % value on the card itself is a measure alredy.

 

 

Anonymous
Not applicable

So if i understand this correctly you want your KPI cards to show the results of the last completed month.  Easiest option is to create a measure that is current month - 1.  Then use that as your date indicator for your KPI card.  It should change based on selection.  

 

let me know if i understand your question correctly

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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