Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
I need to find out if it's possible to solve following case.
In the Fact table there are STOCKS na SALES data aggregated to Date.
User can select/filter data by Year & Month, Year & Week, Year & Quater & Month.
Last (smalest) element defines INTERVAL od data agregation.
Result should show data for selected/filtered period of time, agregated by INTERVAL.
STOCKS in the result must be data for the End Date of the INTERVAL.
In other words STOCK data should be selectively exluded (or marked as excluded) based on curent filter context.
Solved! Go to Solution.
Hi @ggyczew ,
Here are the steps you can follow:
1. Use Enter data to create a Table as a slicer.
2. Create measure.
Year & Month =
IF(
MAX('Table'[Date])=
MAXX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),
[Date]),1,0)
Year & Week =
IF(
MAX('Table'[Date])=
MAXX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&WEEKNUM('Table'[Date],1)=WEEKNUM(MAX('Table'[Date]),1)),
[Date]),1,0)
Year & Quater & Month =
IF(
MAX('Table'[Date])=
MAXX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&QUARTER('Table'[Date])=QUARTER(MAX('Table'[Date]))),
[Date]),1,0)
Flag =
var _select=
SELECTEDVALUE('Slicer_Table'[Slicer])
return
SWITCH(
TRUE(),
_select="Year & Month",[Year & Month],
_select="Year & Week",[Year & Week],
_select="Year & Quater & Month",[Year & Quater & Month])
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @ggyczew ,
Here are the steps you can follow:
1. Use Enter data to create a Table as a slicer.
2. Create measure.
Year & Month =
IF(
MAX('Table'[Date])=
MAXX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),
[Date]),1,0)
Year & Week =
IF(
MAX('Table'[Date])=
MAXX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&WEEKNUM('Table'[Date],1)=WEEKNUM(MAX('Table'[Date]),1)),
[Date]),1,0)
Year & Quater & Month =
IF(
MAX('Table'[Date])=
MAXX(FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&QUARTER('Table'[Date])=QUARTER(MAX('Table'[Date]))),
[Date]),1,0)
Flag =
var _select=
SELECTEDVALUE('Slicer_Table'[Slicer])
return
SWITCH(
TRUE(),
_select="Year & Month",[Year & Month],
_select="Year & Week",[Year & Week],
_select="Year & Quater & Month",[Year & Quater & Month])
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
There is better solution.
"SalesLastDayOfInterval", CALCULATE([Sales Amount], FILTER(Date, 'Date'[Date] = CALCULATE (MAX('Date'[Date]), ALLSELECTED(Date))
Example
https://dax.do/gPu8nlHs9U1BkR/
I have sum of Sales by smallest Calendar Interval and Sales for the Last Day of ecah Interval
After adding Date to ungroup Month
Example. Current Month 3 weeks (ends on Sunday)
Could you provide the sample data and expected result.
User | Count |
---|---|
90 | |
88 | |
87 | |
79 | |
49 |
User | Count |
---|---|
153 | |
145 | |
106 | |
74 | |
55 |