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

Power Bi to show only Net Values for Current week compared to previous week.

Hi All, Struggling to find a logic to create a measure to identify and return only values which are new compared to previous week. below is the sample data. As show in the below table measure should only return highlighted in bold italic. 

DateIDNameGroup
21/11/2022F046DamianA
21/11/2022F047DanielA
21/11/2022F048DavidA
21/11/2022F049DebbieA
21/11/2022F050DespinaA
21/11/2022F051ElkeB
21/11/2022F052ErikalynB
21/11/2022F053FelicityB
21/11/2022F054FionaC
21/11/2022F055GaryD
28/11/2022F046DamianA
28/11/2022F047DanielA
28/11/2022F048DavidA
28/11/2022F049DebbieA
28/11/2022F050DespinaA
28/11/2022F051ElkeB
28/11/2022F052ErikalynB
28/11/2022F053FelicityB
28/11/2022F054FionaC
28/11/2022F055GaryD
28/11/2022F056JamesA
28/11/2022F054FionaB
28/11/2022F055GaryB
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can follow the steps below to get it, please find the details in the attachment.

1. Create a measure as below

Flag = 
VAR _selid =
    SELECTEDVALUE ( 'Table'[ID] )
VAR _selname =
    SELECTEDVALUE ( 'Table'[Name] )
VAR _selgroup =
    SELECTEDVALUE ( 'Table'[Group] )
VAR _maxdate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[ID] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[ID] = _selid
                && 'Table'[Name] = _selname
                && 'Table'[Group] = _selgroup
                && 'Table'[Date] < _maxdate
        )
    )
RETURN
    IF ( ISBLANK ( _count ), 1, 0 )

2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)

yingyinr_0-1670228831839.png

Best Regards

Community Support Team _ Rena
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-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can follow the steps below to get it, please find the details in the attachment.

1. Create a measure as below

Flag = 
VAR _selid =
    SELECTEDVALUE ( 'Table'[ID] )
VAR _selname =
    SELECTEDVALUE ( 'Table'[Name] )
VAR _selgroup =
    SELECTEDVALUE ( 'Table'[Group] )
VAR _maxdate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[ID] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[ID] = _selid
                && 'Table'[Name] = _selname
                && 'Table'[Group] = _selgroup
                && 'Table'[Date] < _maxdate
        )
    )
RETURN
    IF ( ISBLANK ( _count ), 1, 0 )

2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)

yingyinr_0-1670228831839.png

Best Regards

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

Hi,

Here is one way to do this:

Create the following dax:

Previous week filter = IF(ISBLANK(
    CALCULATE(MAX('Table (14)'[Name]),MAX('Table (14)'[Date])-7='Table (14)'[Date],ALL('Table (14)'[Date]))),
    1,0)

Place it into filter:
ValtteriN_0-1669986326199.png

 

This will return the desired values + values which don't have value 3 weeks ago (since there is no data before this):
ValtteriN_1-1669986382401.png

 

Now you can create maxdate filter measure or use relative date filtering:
ValtteriN_2-1669986427068.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

Top Solution Authors