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
Wilm117
Helper I
Helper I

YTD vs YTD 14 days before last datapoint

Hi Everybody,

 

I am working on a report in which I present a number of notifications. I want to see the total number of notifications per day and presented in a YTD format. I also want to show the # YTD notifications 14 days before each date, as shown in the table. Can somebody help me with the right DAX formula? 

 

Thanks you so much!

 

Date# notificationsYTD notificationsYTD notifications - 14 days
1-2-2022 4 
2-2-2022 4 
3-2-202215 
4-2-202216 
5-2-2022 6 
6-2-2022 6 
7-2-202217 
8-2-2022 7 
9-2-2022 7 
10-2-202218 
11-2-2022 8 
12-2-2022 8 
13-2-2022 8 
14-2-2022 84
15-2-2022 84
16-2-2022 85
17-2-2022 86
18-2-2022 86
19-2-2022 86
20-2-2022 87
21-2-20222107
22-2-2022 107
23-2-2022 108
24-2-20222128
25-2-2022 128
26-2-2022 128
27-2-2022 128
28-2-2022 128

 

 

1 ACCEPTED SOLUTION

hi @Wilm117 

then try to plot a table visual with Date column and two measures like:

YTD =
COUNTROWS(
    FILTER(
        ALL(TableName),
        TableName[Date]<=MAX(TableName[Date])
    )
)

YTD -14 =
COUNTROWS(
    FILTER(
        ALL(TableName),
        TableName[Date]<=MAX(TableName[Date])-14
    )
)

View solution in original post

4 REPLIES 4
Wilm117
Helper I
Helper I

The calculated column doesn't work, because the example i gave came from a table in power BI and not direcly from the data source. my bad.

 

The table i presented was derrived from the spreadsheet which is the data source, which can be found below. 

 

I'd like get the same output, but based on the dataset below. Each notification_ID is unique and i want to see the amount of unique notifications per day. This data is connected to a date table, which i would like to incorporate in my DAX. Is this possible? 

 

Notification_IDDate
2022-02-01 08:35-N2011-2-2022
2022-02-01 08:36-N2211-2-2022
2022-02-01 08:38-N4201-2-2022
2022-02-02 11:43-N2292-2-2022
2022-02-02 15:45-N2212-2-2022
2022-02-02 21:17-N2372-2-2022
2022-02-03 09:48-N2303-2-2022
2022-02-03 11:34-N2013-2-2022
2022-02-03 14:00-N2383-2-2022
2022-02-04 07:27-N4084-2-2022
2022-02-04 12:07-Waterlinie4-2-2022
2022-02-04 19:33-N2044-2-2022
2022-02-04 19:37-Waterlinieweg4-2-2022
2022-02-04 19:39-Waterlinieweg4-2-2022
2022-02-05 17:33-N2335-2-2022
2022-02-06 12:54-N2266-2-2022
2022-02-06 16:05-N2376-2-2022
2022-02-06 22:10-N2106-2-2022
2022-02-07 08:20-N2307-2-2022
2022-02-07 10:12-Amsterdamsestraatweg - Industrieweg7-2-2022
2022-02-07 11:47-N2307-2-2022
2022-02-07 14:51-N2377-2-2022
2022-02-07 15:22-N2387-2-2022
2022-02-07 17:04-N2247-2-2022

hi @Wilm117 

then try to plot a table visual with Date column and two measures like:

YTD =
COUNTROWS(
    FILTER(
        ALL(TableName),
        TableName[Date]<=MAX(TableName[Date])
    )
)

YTD -14 =
COUNTROWS(
    FILTER(
        ALL(TableName),
        TableName[Date]<=MAX(TableName[Date])-14
    )
)

Thanks, this worked!

FreemanZ
Super User
Super User

hi @Wilm117 

try to add two calculated columns like:

YTD =
SUMX(
    FILTER(
        TableName,
        TableName[Date]<=EARLIER(TableName[Date])
    ),
    TableName[# notifications]
)

YTD -14 =
SUMX(
    FILTER(
        TableName,
        TableName[Date]<=EARLIER(TableName[Date])-14
    ),
    TableName[# notifications]
)

 

it worked like:

FreemanZ_0-1680700892934.png

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.