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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Slicer instead of filter with calculated column

Hi,

 

The table below shows the amount of breakdowns for a specific date range with the report details.
DepannageID is unique, LiftID (LiftNaam) is not. "Aantal" shows the total amount of breakdowns with the active filters.

(5 rows with the same LiftID = 5)

pbi.png

I currently have a filter to get the total amount of items based on a time range.

 

Aantal = CALCULATE(
	COUNT(
		'F_DEPANNAGEANALYSE'[LiftID]
	);
	FILTER(
		'F_DEPANNAGEANALYSE';
		EARLIER(
			'F_DEPANNAGEANALYSE'[LiftID]
		) = 'F_DEPANNAGEANALYSE'[LiftID]
	);
	FILTER (
        'F_DEPANNAGEANALYSE',
            DATE(YEAR(NOW());MONTH(NOW())-6; DAY(NOW())) <= F_DEPANNAGEANALYSE[DepannageUitgevoerdDatumtijd]
            && F_DEPANNAGEANALYSE[DepannageOproepDatumtijd] <= DATE(YEAR(NOW());MONTH(NOW()); DAY(NOW()))
    ),
    all('F_DEPANNAGEANALYSE')
)

So the date range filter is not working on the last "Aantal" column. I currently hard coded the date range.
Is there any way to achieve this? I already tried a lot of suggestions on the forums (both measured and calculated table based).

Short: i am looking for an OUTER APPLY alternative in DAX (since i am not able to add the dynamic date filter in the SQL query).

Kind regards
Maxim

4 REPLIES 4
amitchandak
Super User
Super User

what is the date filter you want ?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

It should replace this:

 

FILTER (
        'F_DEPANNAGEANALYSE',
            DATE(YEAR(NOW());MONTH(NOW())-6; DAY(NOW())) <= F_DEPANNAGEANALYSE[DepannageUitgevoerdDatumtijd]
            && F_DEPANNAGEANALYSE[DepannageOproepDatumtijd] <= DATE(YEAR(NOW());MONTH(NOW()); DAY(NOW()))
    ),

You can see the slicer in my screenshot. (Top left)
But is has no effect on the calculated column.

Hi @Anonymous ,
 
Try to use ALLSELECTED instead of ALL.
 
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

This is what i'm trying to achieve, calculated column:

Aantal = CALCULATE(
	COUNT(
		'F_DEPANNAGEANALYSE'[LiftID]
	);
	FILTER(
		ALLSELECTED('F_DEPANNAGEANALYSE');
		EARLIER(
			'F_DEPANNAGEANALYSE'[LiftID]
		) = 'F_DEPANNAGEANALYSE'[LiftID]
	)
)

When I use the code above, my total count is not working anymore. It counts all breakdowns (depannages - period: all time).
It SHOULD show the total of breakdowns / LiftID (elevatorID) for that time period.

(Current example: 5 instead of 33)
b1.pngb2.png

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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