Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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 |
---|---|
114 | |
73 | |
57 | |
47 | |
38 |
User | Count |
---|---|
168 | |
120 | |
60 | |
58 | |
53 |