Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Umar
Regular Visitor

Need Help with Filter in Calculate

i am using below DAX expression to get the Account[DownloadDate] Per Quarter, i need to refine my result a little.

 

Evaluate
SummarizeColumns(
Dim_Calendar[FYQ],
"Test Measure",
CALCULATE
(
DISTINCTCOUNT(Dim_Accounts[Id]),
FILTER
(
Dim_Accounts,
Dim_Accounts[DownloadDate] >= FIRSTDATE(Dim_Calendar[Date])
&&
Dim_Accounts[DownloadDate] < NEXTDAY(LASTDATE(Dim_Calendar[Date]))
)
)
)
Order by Dim_Calendar[FYQ]

 

and here is the result i am getting 

 

Dim_Calendar[FYQ][Test Measure]
FY17Q33
FY17Q427
FY18Q120
FY18Q213
FY18Q38
FY18Q45

 

however i need to start it from the current quarter, which is FY17Q4 and want to get the same value next year, same quarter i.e. Example for "Account Id A"

      1. FY18Q1 Account Id A downloads Count = 1 
      2. FY18Q2-4 Count = 0
      3. FY19Q1 Count = 1 (should get this next year, next quarter.

Please help me out here.

1 ACCEPTED SOLUTION

Actually this solved my problem, may be i couldn't expalin the scenario properly.

CountRows
(
Filter
(
ADDCOLUMNS
(
CALCULATETABLE(
SUMMARIZE
(
Dim_Accounts,
Dim_Accounts[Id],
Dim_Accounts[DownloadDate],
"DownloadedDay",LOOKUPVALUE(Dim_Calendar[FYD], Dim_Calendar[Date], Dim_Accounts[DownloadDate])
),
CALCULATETABLE(
Fact_Orders,
ALL(Dim_Calendar)
)
),
"Active",CONTAINS(VALUES(Dim_Calendar[FYD]), Dim_Calendar[FYD], [DownloadedDay])
),
[ACTIVE] = TRUE
&&
Dim_Accounts[DownloadDate] < MAX(Dim_Calendar[Date])
)
)

View solution in original post

5 REPLIES 5
v-haibl-msft
Microsoft Employee
Microsoft Employee

@Umar

 

Has your problem got resolved?

 

Best Regards,
Herbert

Actually this solved my problem, may be i couldn't expalin the scenario properly.

CountRows
(
Filter
(
ADDCOLUMNS
(
CALCULATETABLE(
SUMMARIZE
(
Dim_Accounts,
Dim_Accounts[Id],
Dim_Accounts[DownloadDate],
"DownloadedDay",LOOKUPVALUE(Dim_Calendar[FYD], Dim_Calendar[Date], Dim_Accounts[DownloadDate])
),
CALCULATETABLE(
Fact_Orders,
ALL(Dim_Calendar)
)
),
"Active",CONTAINS(VALUES(Dim_Calendar[FYD]), Dim_Calendar[FYD], [DownloadedDay])
),
[ACTIVE] = TRUE
&&
Dim_Accounts[DownloadDate] < MAX(Dim_Calendar[Date])
)
)
Anonymous
Not applicable

Do you have an easy way to identify the first date of the current quarter?  If so could you write it into a measure?  If you did that, could you change your current measure to:

 

VAR StartDate = [FirstDateOfQuarter]
RETURN
Evaluate
	SummarizeColumns
	(
		Dim_Calendar[FYQ],
		"Test Measure",
		CALCULATE
		(
			DISTINCTCOUNT(Dim_Accounts[Id]),
			FILTER
			(
				Dim_Accounts,
				Dim_Accounts[DownloadDate] >= FIRSTDATE(Dim_Calendar[Date])
				&&
				Dim_Accounts[DownloadDate] < NEXTDAY(LASTDATE(Dim_Calendar[Date]))
			),
			Dim_Calendar[Date] >= StartDate
		)
	)
Order by Dim_Calendar[FYQ]

Tried this, using 

Var startDate = Calculate(min(dim_calendar[Date]), Filter(Dim_Calendar, Dim_Calendar[Is Current FYQ] = "Current FYQ" ) )

and here is the result, it keep adding the previous count, taking the start date to be 01-10-2017 everytime.

 

Dim_Calendar[FYQ][Test Measure]
FY17Q427
FY18Q147
FY18Q260
FY18Q368
FY18Q473
FY19Q173
FY19Q273
FY19Q373

 

need to do something else, didn't figure out yet, anything else i can try.

Anonymous
Not applicable

Could you be overcomplicating the measure?  What is the use case for it?  Do you simply want to display it in a table visual?  If so what happens if you create a Table Visual and put Dim_Calander[FYQ] as the first value and the following measure as the 2nd?

 

 

Test Measure = 
VAR StartDate = Calculate(min(dim_calendar[Date]), Dim_Calendar[Is Current FYQ] = "Current FYQ")
RETURN
Calculate(
	DISTINCTCOUNT(Dim_Accounts[Id]),
	Dim_Calendar[Date] >= StartDate
)

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors