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.
Hi All
I have huge data set available and would like to filter for FIRST 12 month of each Unique data. Date for each Unique Data may start at different dates but i need to plot first 12 month of each Unique Data.
I have following Columns:
"Unique Data" , "Date", "Value"
Can someone help me with this?
Thanks
Regards
Timur
You could create a table to store the dates for each item, e.g.
Start and end dates =
GENERATE (
DISTINCT ( 'Table'[Unique ID] ),
VAR StartDate =
CALCULATE ( MIN ( 'Table'[Date] ) )
VAR EndDate =
EOMONTH ( StartDate, 12 )
RETURN
ROW ( "Start Date", StartDate, "End Date", EndDate )
)
and then link this to your fact table. If you already have a dimension table you could just add the start and end date columns to that.
You can then create a measure like
First 12 months data =
SUMX (
'Dim table',
VAR StartDate = 'Start and end dates'[Start Date]
VAR EndDate = 'Start and end dates'[End date]
RETURN
CALCULATE (
SUM ( 'Table'[value] ),
KEEPFILTERS ( DATESBETWEEN ( 'Date'[Date], StartDate, EndDate ) )
)
)
Hi @johnt75
Thanks for your prompt reply. But i am still having some issues with above code:
It says cannot convert to a scalar value. Can you please let me know how to fix it?
Many thanks
Are you trying to create that as a measure? Because it needs to be a table not a measure.
Dear @johnt75
I have created "New Column" using this code and still saying cannot convert scalar value
😞
Dear @FreemanZ
Thank you for your response. I have managed successfuly create a table but now when trying to link to main table via "new measures", there is following error message:
is there any steps i am missing?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
24 | |
22 | |
20 | |
15 | |
10 |