Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Example Power BI File: Dropbox - POWER BI - Simplify your life
Hi All,
I have table data like this :
and I create a parameter value to be used to decide values from the column "Total" in Table Data
as shown and explain in the below.
For explain :
Need Help : I would like to know how many continuous months OVER has been running by EMP_NAME?
From the data example is
AA : Continueus 2 months is -> May2024 and Jun2024
BB : Discontinuous
Example Power BI File: Dropbox - POWER BI - Simplify your life
Solved! Go to Solution.
Hi @newyearrrr ,
You can create a measure.
Measure2 =
VAR _currentmonth =
MONTH ( MAX ( [PERIOD] ) )
VAR _currentName =
SELECTEDVALUE ( Data[EMP_NAME] )
VAR _vtable =
ADDCOLUMNS (
FILTER (
SUMMARIZE (
ALLSELECTED ( Data ),
'Data'[EMP_NAME],
'Data'[PERIOD],
"_Check over", 'Data'[CHECK_OVER]
),
[_Check over] <> BLANK ()
),
"_month", MONTH ( [PERIOD] )
)
VAR _vtable2 =
FILTER (
ADDCOLUMNS (
_vtable,
"_diff",
MAXX ( FILTER ( _vtable, [EMP_NAME] = EARLIER ( Data[EMP_NAME] ) ), [_month] ) - [_month] + 1,
"_MoreRow",
COUNTROWS (
FILTER (
_vtable,
[EMP_NAME] = EARLIER ( [EMP_NAME] )
&& [_month] >= EARLIER ( [_month] )
)
)
),
[_MoreRow] = [_diff]
)
RETURN
IF (
_currentmonth
= CALCULATE (
MONTH ( MAX ( 'Data'[PERIOD] ) ),
FILTER ( ALLSELECTED ( Data ), 'Data'[EMP_NAME] = _currentName )
),
IF (
[CHECK_OVER] = 1,
COUNTROWS ( FILTER ( _vtable2, [EMP_NAME] = SELECTEDVALUE ( Data[EMP_NAME] ) ) ),
0
)
)
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @newyearrrr ,
You can create a measure.
Measure2 =
VAR _currentmonth =
MONTH ( MAX ( [PERIOD] ) )
VAR _currentName =
SELECTEDVALUE ( Data[EMP_NAME] )
VAR _vtable =
ADDCOLUMNS (
FILTER (
SUMMARIZE (
ALLSELECTED ( Data ),
'Data'[EMP_NAME],
'Data'[PERIOD],
"_Check over", 'Data'[CHECK_OVER]
),
[_Check over] <> BLANK ()
),
"_month", MONTH ( [PERIOD] )
)
VAR _vtable2 =
FILTER (
ADDCOLUMNS (
_vtable,
"_diff",
MAXX ( FILTER ( _vtable, [EMP_NAME] = EARLIER ( Data[EMP_NAME] ) ), [_month] ) - [_month] + 1,
"_MoreRow",
COUNTROWS (
FILTER (
_vtable,
[EMP_NAME] = EARLIER ( [EMP_NAME] )
&& [_month] >= EARLIER ( [_month] )
)
)
),
[_MoreRow] = [_diff]
)
RETURN
IF (
_currentmonth
= CALCULATE (
MONTH ( MAX ( 'Data'[PERIOD] ) ),
FILTER ( ALLSELECTED ( Data ), 'Data'[EMP_NAME] = _currentName )
),
IF (
[CHECK_OVER] = 1,
COUNTROWS ( FILTER ( _vtable2, [EMP_NAME] = SELECTEDVALUE ( Data[EMP_NAME] ) ) ),
0
)
)
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
but I want to count consecutive value by FACT_OT[PERIOD] , If it is a consecutive month, it will be counted.
Result :
EMP_CODE: 01329 ---> Consecutive = 2
EMP_CODE: 04583 ---> Consecutive = 6
Hi Clara Gong,
Superb!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |