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.
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?
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |