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

Need help in DAX

Hi,

I have one table in Power Bi model, which has year wise Audit information for each supplier and there might the situation where audit might get skip for a particular supplier.

Ex.

Supplier ID  Audit Date         Audit Score 

A                   2018-01-01        10

A                   2016-01-01          7

B                    2015-01-01         5

C                   2018-01-01         8

 

Now there will be one Year level drop for this report. so the reporting requirement is such way that whatever year I choose I need to have the latest audit score details for that supplier till that year.

Ex. For Year 2018

Supplier  Last Audit Date        Last  Audit Score 

A                   2018-01-01        10

B                    2015-01-01         5

C                   2018-01-01         8

 

Ex, for year 2017 it will be 

 

Supplier   Last Audit Date        Last  Audit Score

A                   2016-01-01          7

B                    2015-01-01         5

 

this table is connected to time and supplier dimension ...so Can I calculate the  Last Audit Date , Last  Audit Score dynamically?

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may create a slicer table as below and then create a measure and use it in visual level filter. Here is the sample file.

Latest =
IF (
    MAX ( Data[Audit Date] )
        = CALCULATE (
            MAX ( Data[Audit Date] ),
            FILTER (
                ALLEXCEPT ( Data, Data[Supplier ID] ),
                YEAR ( Data[Audit Date] ) <= SELECTEDVALUE ( 'Table'[Year] )
            )
        ),
    "latest"
)

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may create a slicer table as below and then create a measure and use it in visual level filter. Here is the sample file.

Latest =
IF (
    MAX ( Data[Audit Date] )
        = CALCULATE (
            MAX ( Data[Audit Date] ),
            FILTER (
                ALLEXCEPT ( Data, Data[Supplier ID] ),
                YEAR ( Data[Audit Date] ) <= SELECTEDVALUE ( 'Table'[Year] )
            )
        ),
    "latest"
)

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

You may download my PBI file from here.

 

Hope this helps.


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

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.