Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |