Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
cahghr
New Member

How to make PARALLELPERIOD function work with filters?

Hi All,

 

Need some urgent help with the following data. 

 

SLS_PERSON_CDSLSMAN_NAMEOOS EventVISIT_DT
111001RichardNo15/Feb/16
111001RichardYes5/Feb/16
111001RichardNo1/Feb/16
111001RichardNo24/Jan/16
111001RichardYes24/Jan/16
111001RichardNo11/Jan/16

 

I need to display the solution in Power BI dashboard as

 

SLS_PERSON_CDSLSMAN_NAMEOOS Count (Current Month)OOS Count (Previous Month)
111001Richard11

 

I need a filter for the month for the dashboard so that if user selects "February", OOS Count should get displayed for January and February both.

 

The formulas used are:

 

OOS Count (Current Month) = TOTALMTD(CALCULATE(COUNTROWS('Distribution by Channel PC'), 'Distribution by Channel PC'[OOS Event] = "Yes"), 'Distribution by Channel PC'[Visit Date] )

 

OOS Count (Previous Month) = CALCULATE(COUNTROWS('Distribution by Channel PC'), 'Distribution by Channel PC'[OOS Event] = "Yes", PARALLELPERIOD('Distribution by Channel PC'[Visit Date], -1, MONTH))

 

ISSUE: The above formulas are giving me correct result but the constraint is in selection of filters. If I select "February" , OOS COUNT (Previous Month) is empty. If I multi-select the filter "January & February", both the columns give me correct result.

 

ASK: Can I display OOS COUNT (Previous Month) by having only "February" as my selection in the filter?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @cahghr,

 

Perhaps you can try to use below formulas to get the current month count and previous month count.

Calendar table:

Date = VALUES(Sheet1[VISIT_DT])

Measure to get selected value:

Select = IF(HASONEVALUE('Date'[VISIT_DT]),VALUES('Date'[VISIT_DT]),BLANK()) 

 

 

CountEvent(Current) = CALCULATE(COUNT(Sheet1[OOS Event]),FILTER(ALLSELECTED(Sheet1),FORMAT([VISIT_DT],"mm/yyyy")=FORMAT([Select],"mm/yyyy")&&[OOS Event]="Yes"))

CountEvent(Previous) = 
CALCULATE(COUNT(Sheet1[OOS Event]),FILTER(ALLSELECTED(Sheet1),FORMAT([VISIT_DT],"mm/yyyy")=FORMAT(DATE(YEAR([Select]),MONTH([Select]),1)-1,"mm/yyyy")&&[OOS Event]="Yes"))

 

5.PNG6.PNG

 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @cahghr,

 

Perhaps you can try to use below formulas to get the current month count and previous month count.

Calendar table:

Date = VALUES(Sheet1[VISIT_DT])

Measure to get selected value:

Select = IF(HASONEVALUE('Date'[VISIT_DT]),VALUES('Date'[VISIT_DT]),BLANK()) 

 

 

CountEvent(Current) = CALCULATE(COUNT(Sheet1[OOS Event]),FILTER(ALLSELECTED(Sheet1),FORMAT([VISIT_DT],"mm/yyyy")=FORMAT([Select],"mm/yyyy")&&[OOS Event]="Yes"))

CountEvent(Previous) = 
CALCULATE(COUNT(Sheet1[OOS Event]),FILTER(ALLSELECTED(Sheet1),FORMAT([VISIT_DT],"mm/yyyy")=FORMAT(DATE(YEAR([Select]),MONTH([Select]),1)-1,"mm/yyyy")&&[OOS Event]="Yes"))

 

5.PNG6.PNG

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.