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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kadapavel
Helper II
Helper II

calculate growth of counter

Hello,

please suggest how to calculate growth of the signal.

Capture5.PNG

I tried something like, but seems I do not understand logic well

MCBcounter = 
VAR MCBPreviousDay = 
calculate(
   MIN('[7230004][01][35 05]'[Value])
	RETURN
    '[7230004][01][35 05]'[Value] - MCBPreviousDay

With regards

 

2 ACCEPTED SOLUTIONS
DAX0110
Resolver V
Resolver V

Hi @kadapavel, you're going in the right direction - the signal growth = today's value - previous day's value

 

The previous day's row could be thought of as having the maximum timestamp that's less than today's timestamp.

 

There is probably a more elegant way to express this idea, but this is how I'd do it :

 

Define a calculated column :

 

=VAR thisOrderBy = '[7230004][01][35 05]'[SignalTimestamp]
VAR thisEntity = '[7230004][01][35 05]'[Name]
VAR thisValue = '[7230004][01][35 05]'[Value]
VAR prevValue = CALCULATE( 
	FIRSTNONBLANK('[7230004][01][35 05]'[Value], 0)
	, CALCULATETABLE(
		TOPN( 1 
			, '[7230004][01][35 05]' 
			, '[7230004][01][35 05]'[SignalTimestamp]
			, DESC 
			)
		,  ALL( '[7230004][01][35 05]' )
		, '[7230004][01][35 05]'[Name] = thisEntity
		, '[7230004][01][35 05]'[SignalTimestamp] < thisOrderBy
		)
	)
RETURN
	IF( ISBLANK(prevValue)
		, BLANK()
		,  thisValue - prevValue
	)
	
	

 

 

 

 

View solution in original post

Hi @kadapavel

 

Try this calculated column

 

MCB Counter =
VAR PreviousDate =
    CALCULATE (
        MAX ( TableName[SignalTimeStamp] ),
        FILTER (
            ALL ( TableName ),
            TableName[SignalTimeStamp] < EARLIER ( TableName[SignalTimeStamp] )
        )
    )
RETURN
    TableName[Value]
        - CALCULATE (
            SUM ( TableName[Value] ),
            FILTER ( ALL ( TableName ), TableName[SignalTimeStamp] = PreviousDate )
        )

View solution in original post

3 REPLIES 3
DAX0110
Resolver V
Resolver V

Hi @kadapavel, you're going in the right direction - the signal growth = today's value - previous day's value

 

The previous day's row could be thought of as having the maximum timestamp that's less than today's timestamp.

 

There is probably a more elegant way to express this idea, but this is how I'd do it :

 

Define a calculated column :

 

=VAR thisOrderBy = '[7230004][01][35 05]'[SignalTimestamp]
VAR thisEntity = '[7230004][01][35 05]'[Name]
VAR thisValue = '[7230004][01][35 05]'[Value]
VAR prevValue = CALCULATE( 
	FIRSTNONBLANK('[7230004][01][35 05]'[Value], 0)
	, CALCULATETABLE(
		TOPN( 1 
			, '[7230004][01][35 05]' 
			, '[7230004][01][35 05]'[SignalTimestamp]
			, DESC 
			)
		,  ALL( '[7230004][01][35 05]' )
		, '[7230004][01][35 05]'[Name] = thisEntity
		, '[7230004][01][35 05]'[SignalTimestamp] < thisOrderBy
		)
	)
RETURN
	IF( ISBLANK(prevValue)
		, BLANK()
		,  thisValue - prevValue
	)
	
	

 

 

 

 

Hi @kadapavel

 

Try this calculated column

 

MCB Counter =
VAR PreviousDate =
    CALCULATE (
        MAX ( TableName[SignalTimeStamp] ),
        FILTER (
            ALL ( TableName ),
            TableName[SignalTimeStamp] < EARLIER ( TableName[SignalTimeStamp] )
        )
    )
RETURN
    TableName[Value]
        - CALCULATE (
            SUM ( TableName[Value] ),
            FILTER ( ALL ( TableName ), TableName[SignalTimeStamp] = PreviousDate )
        )

Thank you very much!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.