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
Fon
Frequent Visitor

Create on the fly table based on filter result

All Hi,

 

I am new to Power Bi.

 

I have the following data:

iddatechannelResult
11/1/2019AI
11/2/2019BJ
11/3/2019CK
31/3/2019AI
41/4/2019BK
41/5/2019CJ

 

Assume that there is a slicer that contains the column date.

image.png

Is there any way to get the entire row for each ID where date is the latest, and then slice by field Channel? Using the following measure i am able to calculate the distinct  id's   based on the date slicer.

Measure1 =
COUNTX (
VALUES ( Table1[id] );
CALCULATE ( DISTINCTCOUNT ( Table1[id] ); LASTDATE ( Table1[Date] ) )
)
 
Between 1/1/2019 and 1/3/2019  there are 2 id's (id =1 has channel  C  and id=3 has channel A).  If i choose channel=A, i will get  2 id's again. This happens because the filter channel=A is applied before the calculation of the measure1.
image.png

Is there any way to keep the records  where the date is the latest, and then slice by another field ?

 

Appreciate your feedback.

 

Regards,

Xenofon

 

 

 

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @Fon 

You may create a rank measure and use it in visual level filter like below.

Rank =
RANKX (
    FILTER ( ALL ( 'Table' ), 'Table'[id] = MAX ( 'Table'[id] ) ),
    CALCULATE ( MAX ( 'Table'[date] ) ),
    ,
    DESC
)

1.png

Regards,

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

1 REPLY 1
v-cherch-msft
Employee
Employee

Hi @Fon 

You may create a rank measure and use it in visual level filter like below.

Rank =
RANKX (
    FILTER ( ALL ( 'Table' ), 'Table'[id] = MAX ( 'Table'[id] ) ),
    CALCULATE ( MAX ( 'Table'[date] ) ),
    ,
    DESC
)

1.png

Regards,

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.

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.