Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Could someone help me update this formula:
| Logged In | ID |
| 9/1/2023 | 1234 |
| 10/3/2023 | 1234 |
| 10/5/2023 | 3456 |
| 8/15/2023 | 2345 |
| 10/5/2023 | 2345 |
| 10/9/2023 | 2345 |
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Count Expected result measure: =
VAR _today =
TODAY ()
VAR _lastmonthenddate =
EOMONTH ( _today, -1 )
VAR _twomonthsbeforestartdate =
EOMONTH ( _today, -3 ) + 1
VAR _monthtable =
FILTER (
ADDCOLUMNS (
'Users Logins',
"@year-month", EOMONTH ( 'Users Logins'[Logged In], 0 )
),
[@year-month] >= _twomonthsbeforestartdate
&& [@year-month] <= _lastmonthenddate
)
VAR _summarytable =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( _monthtable, [@year-month], 'Users Logins'[Employee ID] ),
"@logincount", CALCULATE ( COUNTROWS ( 'Users Logins' ) )
),
[@logincount] >= 1
)
VAR _idlist =
SUMMARIZE (
FILTER (
ADDCOLUMNS (
_summarytable,
"@condition",
COUNTROWS (
FILTER (
_summarytable,
'Users Logins'[Employee ID] = EARLIER ( 'Users Logins'[Employee ID] )
)
)
),
[@condition] >= 2
),
'Users Logins'[Employee ID]
)
RETURN
COUNTROWS ( FILTER ( _monthtable, 'Users Logins'[Employee ID] IN _idlist ) )
I am still having difficulty working with this solution. It does not represent a correct count in my visual with the formula above.
A sample visual:
I'd like the highlighted part to be a card visual of the total for those that have logged in the previous month and the month prior to previous month.
This a measurement I created but I do not know how to adjust it to include those two elements.
Thanks for sharing this! Is there a way to have that same visual and it show a running count instead of the employee ID? Is that something to adjust in the formula or in the visual?
Hi,
Please check the below picture and the attached pbix file.
Count Expected result measure: =
VAR _today =
TODAY ()
VAR _lastmonthenddate =
EOMONTH ( _today, -1 )
VAR _twomonthsbeforestartdate =
EOMONTH ( _today, -3 ) + 1
VAR _monthtable =
FILTER (
ADDCOLUMNS (
'Users Logins',
"@year-month", EOMONTH ( 'Users Logins'[Logged In], 0 )
),
[@year-month] >= _twomonthsbeforestartdate
&& [@year-month] <= _lastmonthenddate
)
VAR _summarytable =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( _monthtable, [@year-month], 'Users Logins'[Employee ID] ),
"@logincount", CALCULATE ( COUNTROWS ( 'Users Logins' ) )
),
[@logincount] >= 1
)
VAR _idlist =
SUMMARIZE (
FILTER (
ADDCOLUMNS (
_summarytable,
"@condition",
COUNTROWS (
FILTER (
_summarytable,
'Users Logins'[Employee ID] = EARLIER ( 'Users Logins'[Employee ID] )
)
)
),
[@condition] >= 2
),
'Users Logins'[Employee ID]
)
RETURN
COUNTROWS ( FILTER ( _monthtable, 'Users Logins'[Employee ID] IN _idlist ) )
Hi,
I am not sure how your datamodel looks like or what visualization you want to use to describe the result, but please check the below picture and the attached pbix file if it suits your requirement.
Expected result measure: =
VAR _today =
TODAY ()
VAR _lastmonthenddate =
EOMONTH ( _today, -1 )
VAR _twomonthsbeforestartdate =
EOMONTH ( _today, -3 ) + 1
VAR _monthtable =
FILTER (
ADDCOLUMNS (
'Users Logins',
"@year-month", EOMONTH ( 'Users Logins'[Logged In], 0 )
),
[@year-month] >= _twomonthsbeforestartdate
&& [@year-month] <= _lastmonthenddate
)
VAR _summarytable =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( _monthtable, [@year-month], 'Users Logins'[Employee ID] ),
"@logincount", CALCULATE ( COUNTROWS ( 'Users Logins' ) )
),
[@logincount] >= 1
)
RETURN
SUMMARIZE (
FILTER (
ADDCOLUMNS (
_summarytable,
"@condition",
COUNTROWS (
FILTER (
_summarytable,
'Users Logins'[Employee ID] = EARLIER ( 'Users Logins'[Employee ID] )
)
)
),
[@condition] >= 2
),
'Users Logins'[Employee ID]
)
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |