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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
subhendude
Employee
Employee

Snow non-blank latest row data in a matrix table

I have a dataset containing machine inventory details, including owner information and power consumption. When a machine stops, the owner field is left blank, and power consumption is set to zero. For instance, Machine 4 stopped on May 2nd, which is why its owner field is blank and its consumption is zero. Similarly, Machine 5 stopped on May 3rd, resulting in a blank owner field and zero consumption.

subhendude_0-1715973522123.png

When I plot the data in a matrix, the owner field is repeated twice for Machine 4 and Machine 5, likely due to two variations in the owner data.

subhendude_1-1715973558475.png

I would like to display the most recent non-blank owner information for these machines in the Owner field. For instance, Machine 4 should show Owner4, and Machine 5 should show Owner5 like below

subhendude_2-1715973584769.png

Can anyone sugesst how to show this? Any help is really appreciated.

 

Thanks!

 

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @subhendude 
Maybe it is not the most elegant way, but it works 🙂

You can create 2 calculated columns :

1. For last nonblank date for every machine :

LastNonBlankDate =
VAR CurrentMachine = [Machine]
VAR CurrentDate = [Date]
RETURN
    CALCULATE(
        MAX('Table'[Date]),
        FILTER(
            'Table',
            'Table'[Machine] = CurrentMachine &&
            'Table'[Owner] <> BLANK() &&
            'Table'[Consumption] > 0 &&
            'Table'[Date] <= CurrentDate
        )
    )

2. For the owner in this date

LastOwnerOnDate =
VAR CurrentMachine = [Machine]
VAR LastNonBlankDate = [LastNonBlankDate]
RETURN
    CALCULATE(
        MAX('Table'[Owner]),
        FILTER(
            'Table',
            'Table'[Machine] = CurrentMachine &&
            'Table'[Date] = LastNonBlankDate
        )
    )
Ritaf1983_0-1716018536657.png

Now, you can use the calculated owner in your visuals:

Ritaf1983_1-1716018630269.png

The pbix is attached

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

 

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, use the "Fill down" feature on the Owner column


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ritaf1983
Super User
Super User

Hi @subhendude 
Maybe it is not the most elegant way, but it works 🙂

You can create 2 calculated columns :

1. For last nonblank date for every machine :

LastNonBlankDate =
VAR CurrentMachine = [Machine]
VAR CurrentDate = [Date]
RETURN
    CALCULATE(
        MAX('Table'[Date]),
        FILTER(
            'Table',
            'Table'[Machine] = CurrentMachine &&
            'Table'[Owner] <> BLANK() &&
            'Table'[Consumption] > 0 &&
            'Table'[Date] <= CurrentDate
        )
    )

2. For the owner in this date

LastOwnerOnDate =
VAR CurrentMachine = [Machine]
VAR LastNonBlankDate = [LastNonBlankDate]
RETURN
    CALCULATE(
        MAX('Table'[Owner]),
        FILTER(
            'Table',
            'Table'[Machine] = CurrentMachine &&
            'Table'[Date] = LastNonBlankDate
        )
    )
Ritaf1983_0-1716018536657.png

Now, you can use the calculated owner in your visuals:

Ritaf1983_1-1716018630269.png

The pbix is attached

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

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.