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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Invoke function to point a custom

Hi all,

I definited 5 data groups :

PI event = SWITCH(TRUE();

Totally[Week]>="19W49"&&Totally[Week]<="20W09";"PI19W49";

Totally[Week]>="20W10"&&Totally[Week]<="20W21";"PI20W10";

Totally[Week]>="20W22"&&Totally[Week]<="20W36";"PI20W22";

Totally[Week]>="20W37"&&Totally[Week]<="20W48";"PI20W37";

Totally[Week]>="20W49"&&Totally[Week]<="20W52";"PI20W49"

)

Then I want to compare the Totally[C12 PERCENTAGE] value between two PIXXX:

 

PI O PI = VAR __BASELINE_VALUE =

    CALCULATE(Totally[C12 PERCENTAGE];LASTNONBLANK(Totally[PI event];-1))

VAR __MEASURE_VALUE = Totally[C12 PERCENTAGE]

RETURN

FORMAT(

    DIVIDE( __MEASURE_VALUE-__BASELINE_VALUE; __BASELINE_VALUE);

"0.0%")

 But the result is not what I want, maybe the function LASTNONBLANK is incorrect, so can someone tell me which function I should invoke and how to make the result correctly?

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , seem like Totally[PI event] is created as a column then there should be some filter use on this like

 

CALCULATE(Totally[C12 PERCENTAGE];Totally[PI event]= LASTNONBLANK(Totally[PI event];-1))

 

What do you want to filter? LASTNONBLANK will take row context

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
Anonymous
Not applicable

Yes, the PI event is created as a column, and grouped by weeks. 

There are 5 "PI event" in this column, and I want to analyze the data (C12 PERCENTAGE) in different period time.

So could you tell me which function should I use?

Hi @Anonymous ,

 

Would you please try to use the following formula:

 

 

CALCULATE(Totally[C12 PERCENTAGE];Totally[PI event]= LASTNONBLANK(ALL(Totally[PI event]);-1))

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.