Resolved it myself. The code below does the job:
WITH
MEMBER [Measures].[Days in the period passed] AS
FILTER
(
Descendants([Time].[Calendar], [Time].[Calendar].[Day]),
[Time].[Day].Properties("Day key") <= FORMAT(NOW(), "yyyyMMdd")
).COUNT
EDIT: more elegant and correct way is the scope:
SCOPE
(
[Measures].[Days in the period passed], [Time].[Day].[Day].Members
);
THIS = IIF([Time].[Day].CurrentMember.Properties( "Key0" ) <= FORMAT(NOW(), "yyyyMMdd"),
[Measures].[Days in the period],
NULL);
END SCOPE;
Checking select:
SELECT
([Time].[Calendar].[Mouth]) ON COLUMNS,
(([Measures].[Days in the period passed])) ON ROWS
FROM [TestCube]