Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
i have historical data with filename - mm-dd-yy format also each file has date column which has date of the file got stored.
we are processing same thing every week and storing the files. i have grouped files by max date logic splitting the date from file name and have the expected data module.
now i wish to calculate customer count by month and when i select the any month the visule should display that month data and if no month is not selected then visual should display currant month data
By using below DAX i have the result but not for currant month
Solved! Go to Solution.
Hi,
Please try to change the original measure to this:
Measure =
SWITCH (
TRUE,
SELECTEDVALUE ( 'Date Slicer'[Month] ) = BLANK ()
&& SELECTEDVALUE ( 'Date Slicer'[FiscalYear] ) <> BLANK (), CALCULATE (
DISTINCTCOUNT ( Sheet1[Customer ID] ),
FILTER (
Sheet1,
MONTH ( Sheet1[Month&Year] )
= MONTH ( TODAY () ) - 1
&& Sheet1[Year]
= CALCULATE (
VALUE ( ( MAX ( 'Date Slicer'[Year] ) ) ),
FILTER (
'Date Slicer',
'Date Slicer'[FiscalYear] = SELECTEDVALUE ( 'Date Slicer'[FiscalYear] )
)
)
)
),
SELECTEDVALUE ( 'Date Slicer'[Month] ) = BLANK ()
&& SELECTEDVALUE ( 'Date Slicer'[FiscalYear] ) = BLANK (), CALCULATE (
DISTINCTCOUNT ( Sheet1[Customer ID] ),
FILTER (
Sheet1,
MONTH ( Sheet1[Month&Year] )
= MONTH ( TODAY () ) - 1
&& Sheet1[Year] = YEAR ( TODAY () )
)
),
SELECTEDVALUE ( 'Date Slicer'[Month] ) <> BLANK ()
&& SELECTEDVALUE ( 'Date Slicer'[FiscalYear] ) <> BLANK (), CALCULATE (
DISTINCTCOUNT ( Sheet1[Customer ID] ),
FILTER (
Sheet1,
MONTH ( Sheet1[Month&Year] )
= CALCULATE (
MONTH ( MAX ( 'Date Slicer'[Date] ) ),
FILTER (
'Date Slicer',
'Date Slicer'[Month] = SELECTEDVALUE ( 'Date Slicer'[Month] )
)
)
&& Sheet1[Year]
= CALCULATE (
VALUE ( MAX ( 'Date Slicer'[Year] ) ),
FILTER (
'Date Slicer',
'Date Slicer'[FiscalYear] = SELECTEDVALUE ( 'Date Slicer'[FiscalYear] )
)
)
)
)
)
When you do not select any slicer, it shows the current year current month data:
Here is my changed pbix file:
Best Regards,
Giotto Zhi
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
96 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |