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

Non-date visual slicer for week to date column

Hi team,

 

I'm looking for answer whether i can display week-to-date formula with visual filter that is not related to date

 

There are 2 tables : Date and UD

[Date].Date is connected to [UD].StartDate

 

I have Week-To-Date formula to count number of 'ID' and this is perfectly working fine with date slicer:

#Apps_WTD =
var CurrentDate = LASTDATE('Date'[Date])
var DayNumberOfWeek = WEEKDAY(LASTDATE('Date'[Date]), 3)

RETURN
CALCULATE(
COUNT(UD[Id]),
DATESBETWEEN( 'Date'[Date],
DATEADD(CurrentDate, -1*DayNumberOfWeek, DAY),
CurrentDate)
)
 
Then, I also need to provide last week-to-date data for each 'Status'. 'Status' column is available in UD table and this is where I can't find the answer. Table below is what I'm expecting
 
StatusLast Week To Date - Count of Id
ApprovedA
DeclinedB
ReferredC

 

Instead this is what I got when 'Week to date' formula is dragged to the table visual, it just returned blank

StatusLast Week To Date - Count of Id
blankblank

 

This can be achieved for MTD and YTD with their built-in function and I'm not sure how to achieve the same for WTD. Can anyone shed some light please ?

3 REPLIES 3
Anonymous
Not applicable

@amitchandak  thank you. i used the WTD method in your blog, it gives the correct result when using date slicer in table but incorrect if the slicer is status. I have attached link to PBIX file where WTD 2 formula where it is based on your blog.

 

@v-henryk-mstf  yes, the DAX formula I wrote will return blank if status slicer is used, but correct for date slicer. Attached is the PBIX file with WTD 1 and WTD 2 and both DAX formulas are not able to return value WTD with Status as slicer.

 

Link to PBIX file : https://drive.google.com/file/d/1NuaMgkVqmj0v8_aAFF1IQkQMfyYwj1at/view?usp=sharing 

 

Any idea what I did wrong ?

v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

According to the information you give, the result returned by the DAX formula you wrote is blank. I checked the errors. According to the DATEADD(CurrentDate, - 1 * DayNumberOfWeek, Day) filter conditions, if you want to get dates that are one day before the dates in the current context, you might as well change it to DATEADD(CurrentDate, - 1, day). If the result is still problems, you may as well provide two more tables with more detailed data and information. I can help you with further tests.

Best Regards,
Henry

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.