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.
I am counting the number of vehicles at the end of each month.
In my DimDate table I have (among other columns) Year (text), Year Month (text) and Date (Date) and OnlyLastDayofMonth (ABC/123) with only the last date of each month in it.
Each vehicle is included in all dates in a range from start date to end date.
My measure:
How can I get 12 months + the last month of the preceeding year as the first visible month? I.e. 13 months instead of 12?
Thanks, Anna.
Solved! Go to Solution.
Hi @Anonymous
Thanks for your reply.
The reason for the error is because you use the year from dimdate as the slicer, so the visual will be filtered.
(1) In this scenario, you need to create a year table for slicer,
(2) then try this, create the measure below,
Vehicle Count end of month =
VAR _End =
DATE ( SELECTEDVALUE(YearSlicer[Year]), 12, 31 )
VAR _start =
EOMONTH ( _End, -13 )
return IF(MIN(DimDate[Date])<_End,
CALCULATE (
DISTINCTCOUNT ( 'TestObject/Transactions'[test_object_id] ),
FILTER (
'TestObject/Transactions',
'TestObject/Transactions'[date] > _start
&& 'TestObject/Transactions'[date] < EOMONTH( MIN(DimDate[Date]),0)
)
) ,BLANK())
then it returns the distinctcount of [test_object_id] at the end of each month
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Please try this measure
Vehicle Count end of month =
VAR _End =
DATE ( MIN ( 'DimDate'[Year] ), 12, 31 )
VAR _start =
EOMONTH ( _End, -13 )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'TestObject/Transactions'[test_object_id] ),
FILTER (
'TestObject/Transactions',
'TestObject/Transactions'[date] > _start
&& 'TestObject/Transactions'[date] <= _End
)
)
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Thank you! Brilliant thinking! @v-xiaotang
The thing is, I am counting vehicled that exist beteen dates (Delivery date and end date). So I have an interval table and then I count the vehices at the end of each month.
Whe I used yoyr brilliant measure (changed a bit):
Hi @Anonymous
Thanks for your reply.
The reason for the error is because you use the year from dimdate as the slicer, so the visual will be filtered.
(1) In this scenario, you need to create a year table for slicer,
(2) then try this, create the measure below,
Vehicle Count end of month =
VAR _End =
DATE ( SELECTEDVALUE(YearSlicer[Year]), 12, 31 )
VAR _start =
EOMONTH ( _End, -13 )
return IF(MIN(DimDate[Date])<_End,
CALCULATE (
DISTINCTCOUNT ( 'TestObject/Transactions'[test_object_id] ),
FILTER (
'TestObject/Transactions',
'TestObject/Transactions'[date] > _start
&& 'TestObject/Transactions'[date] < EOMONTH( MIN(DimDate[Date]),0)
)
) ,BLANK())
then it returns the distinctcount of [test_object_id] at the end of each month
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi,
See if my post here helps - Flex a Pivot Table to show data for x months ended a certain user defined month.
No sorry 😞
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |