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
saranyasf
New Member

Rebasing value to 0 when filtered on date slicer

Hello everyone,

 

I am new to DAX measures in Power BI and couldn't find my way around rebasing values. I have a list of public firms and their share price changes for over a year (from 02 Jan 2019 till date). I have a date slicer for the same dates. The first row values i.e. the share price change % for the first day/2nd Jan 2019 is zero. What I am looking for is when I filter on the dates slicer - for example to see the moement between say 15 March and today, the value for 15 March should be zero (rebased to 0 on 15th March)

It looks like this now.It looks like this now.

 

It looks like above image now. I am attaching the desired look below (adjusted, slicer doesn't interact with table below)

 

Capture1.JPG

 

Please suggest. 

1 REPLY 1
Anonymous
Not applicable

You have to have a proper Calendar in your model. Then

 

 

Payment Change DoD% 2 = 
var __oneDateVisible = HASONEVALUE( Calendar[Date] )
return
if( __oneDateVisible,
	var __previousDay = 
        CALCULATETABLE(
            VALUES( 'Calendar'[Date] ),
            PREVIOUSDAY( 'Calendar'[Date] ),
            ALLSELECTED( 'Calendar' )
        )
	var __currDayPrice = [Total Payment]
	var __prevDayPrice = 
        CALCULATE(
            [Total Payment],
            __previousDay
        )
	var __delta = __currDayPrice - __prevDayPrice
	return
			DIVIDE( __delta, __prevDayPrice ) + 0
)

 

 

This is a TOP-LEVEL measure and cannot be used in iterators of any kind. Please do not use this in other measures.

 

Best

D

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.

Top Solution Authors