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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Adi98
Frequent Visitor

Unable to create measure based on slicer

Adi98_2-1650866830326.png      Adi98_3-1650866876283.png

 

I have created this visual which shows storage by week of year and a chiclet slicer to select weeks. Now in the visual there is a text box which shows percentage increase or decrease of storage of the latest two weeks selected in slicer. As of now I am calculating that percentage difference manually and updating in textbox as required.

The formula for calculating percentage is = (storage of latest week - storage of next latest week)/ storage of next latest week * 100

for eg. (storage of week 13 - storage of week 12) / storage of week 12 * 100

 

My issue is that I want to create a measure that calculates this percentage value automatically as I select values in that chiclet slicer. Is there any way possible?

 

 

 

2 REPLIES 2
danextian
Super User
Super User

Hi @Adi98 ,

If you a week number as a number, this will be a lot easier. You can do something like below to calculate for the value from the prior week.

Value PrevWeek = 
VAR __PrevWeek =
    SELECTEDVALUE ( 'Table'[Week Number] ) - 1
RETURN
    CALCULATE (
        SUM ( 'Table'[Values] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Week Number] = __PrevWeek )
    )

 

Please see this pbix for a more detailed solution.  https://drive.google.com/file/d/1CQDOW3GrMh0AASAZTFGzXIQtuBoiBZxt/view?usp=sharing 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
amitchandak
Super User
Super User

@Adi98 , You have to create a measure like

 

new measure =
var _max = maxx(allselected(Date),Date[Week])
var _min = minx(allselected(Date),Date[Week])
return
calculate( sum(Table[Value]), filter('Table', 'Table'[Date] =_max)) - calculate( sum(Table[Value]), filter('Table', 'Table'[Date] =_min))

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors