Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I could not make a new column to get the values for the last three months. I checked from other forms, but mine doesn't work.
I have the main table:
| Type | datetext | date | value | order |
| a | 04.2020 | 4.1.2020 | 5 | 4 |
| a | 04.2020 | 4.1.2020 | 4 | 4 |
| a | 03.2020 | 3.1.2020 | 3 | 3 |
| a | 02.2020 | 2.1.2020 | 2 | 2 |
| a | 01.2020 | 1.1.2020 | 1 | 1 |
| b | 04.2020 | 4.1.2020 | 15 | 4 |
| b | 04.2020 | 4.1.2020 | 14 | 4 |
| b | 03.2020 | 3.1.2020 | 13 | 3 |
| b | 02.2020 | 2.1.2020 | 12 | 2 |
| b | 01.2020 | 1.1.2020 | 11 | 1 |
| a | 12.2019 | 12.1.2019 | 1 | 0 |
| b | 12.2019 | 12.1.2019 | 10 | 0 |
I have also 2 more tables and use the slicers from there.
Type table
| Type |
| a |
| b |
Month table
| DateT | Date | Order |
| 03.2020 | 3.1.2020 | 3 |
| 02.2020 | 2.1.2020 | 2 |
| 01.2020 | 1.1.2020 | 1 |
| 04.2020 | 4.1.2020 | 4 |
| 12.2019 | 12.1.2019 | 0 |
I use Type[Type] and Month[DateT] fields for two different slicers.
I wanted to make a new column:
Solved! Go to Solution.
Hi @IF ,
Sorry for my late reply.
Please use this:
sum value =
CALCULATE ( SUM ( 'Table'[value] ), FILTER ( 'Table', [Flag] = 1 ) )
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @IF ,
According to my understanding, you want to count the number of rows based on the selected value of Type and DateT via slicers, right?
First,The value of calculated column is stored in the row that will not change according to the user selection-- Calculated column could not be dynamic.So It's suggested to create measure instead.
Second, you need to delect the relationships between the three tables so that you can custom the cross-filter by measure.
Please try the following formula:
Flag =
VAR _type =
SELECTEDVALUE ( 'Type'[Type] )
VAR _datetext =
SELECTEDVALUE ( 'Month'[DateT] )
VAR _date =
DATE ( RIGHT ( _datetext, 4 ), LEFT ( _datetext, 2 ), 1 )
VAR _v1 =
IF (
MAX ( 'Table'[type] ) = _type
&& MAX ( 'Table'[date] ) <= _date
&& MAX ( 'Table'[date] ) > EOMONTH ( _date, -3 ),
1
)
VAR _v2 =
IF (
MAX ( 'Table'[date] ) <= _date
&& MAX ( 'Table'[date] ) > EOMONTH ( _date, -3 ),
1
)
RETURN
IF ( _type <> BLANK (), _v1, _v2 )
Then use the SUMX() for Card visual:
Count Rows = SUMX('Table',[Flag])
The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi
It works, but I also want to get the sum of Table[Value] for the last 3months based on the selection (same as the other measure.
I tried this:
Hi @IF ,
Sorry for my late reply.
Please use this:
sum value =
CALCULATE ( SUM ( 'Table'[value] ), FILTER ( 'Table', [Flag] = 1 ) )
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Perfect, thanks a lot!
@IF , best to have date table and use that. even if you have data of one day per month in your table
Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-3,MONTH))
or
Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date]),-1) ,-3,MONTH))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Hi,
I tried but didn't work. Can you check if I did smth wrong?
https://www.dropbox.com/s/zz0b6yiloezsduw/3%20month%20rolling%20second%20time.pbix?dl=0
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!