Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Solved! Go to Solution.
Hi @Anonymous
As tested, i can get last n days values correctly.
1. create a calendar table, connect it with your table based on "date" column
calendar = CALENDARAUTO()
2.create a what-if parameter,
3.create a measure in your table
Cash Last n days = CALCULATE(SUM(Sheet5[value]),DATESINPERIOD('calendar'[Date],TODAY(),-[parameter select days Value],DAY))
Hi @Anonymous
As tested, i can get last n days values correctly.
1. create a calendar table, connect it with your table based on "date" column
calendar = CALENDARAUTO()
2.create a what-if parameter,
3.create a measure in your table
Cash Last n days = CALCULATE(SUM(Sheet5[value]),DATESINPERIOD('calendar'[Date],TODAY(),-[parameter select days Value],DAY))
Hi @Anonymous
[PeriodChoice]=selectedvalue('A1 PeriodOptions'[PeriodOption])
I'm having trouble with recreating you problem in my own workbook, so if the following does not work can you then provide some more information like relationships and a little snippet of your fact table?
But it might be beacuse you are not using an actual date table in the datesbetween.
If you create a date table with a 1:* relationship to 'Interrogation Table_Categorised transactions' then you should be able to use the following measure:
cash in period = VAR __selectedPeriod = SELECTEDVALUE( datefilter[dateFilter]; 30) VAR __maxDate = CALCULATE( LASTDATE( 'date'[Date]); FILTER( 'date'; 'date'[Date] <= MAX( 'Interrogation Table_Categorised transactions'[Date]) ) ) RETURN CALCULATE( SUM( 'Interrogation Table_Categorised transactions'[Cash]); DATESBETWEEN( 'date'[Date]; __maxDate - __selectedPeriod; __maxDate ) )
Hi, I have returedn to this problem of mine after a period of time.
This works for when everyone has the same dates in transactions. However, I have a set of data whwere each customer has 12 mths of data, but all with differenct start dates. How can I use this answer you provided to provide:
Summary results across all customers of their latest 30/90/180/365 day period - so taking out the impact of a different start date.
I have done a formula as per below but it isnt acccounting for a customers different start date:
Just to point out that if I replace the 'A1 PeriodOptions'[PeriodChoice] in the DAX and put in -30 or -90,, then the result pulls through fine. I just want to be able to use a slicer with the various no.days as an option ( ie 30,90,180, 365) so I can see what Cash or other measure might total in the last x no. days.
Seems simple but I cant make it work without resorting to the manual over ride above
Cheers
M
An issue could be that SELECTEDVALUE() will return the alternate result if multiple values or no values are selected. Try and make a card visual where you input the measure SELECTEDVALUE('A1 PeriodOptions'[PeriodChoice], 30) just to see if the issue might not work as intended.
Does the table 'A1 PeriodOptions' have any relations to other tables?
Hi,
I made a card amd it filters fine with the slicer in action.
There is no relationship to any other tables
User | Count |
---|---|
77 | |
74 | |
42 | |
32 | |
28 |
User | Count |
---|---|
100 | |
93 | |
52 | |
50 | |
48 |