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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Facing issue with Parallelperiod Dax

Hi All,

         I am using the below dax query to get previous month sum of the data.

Consumption Dollars PM = Calculate([Consumption Dollars],PARALLELPERIOD(Dim_MasterCalendar[Date],-1,MONTH))
and its working as expected.
Note : Here Consumption Dollars is current month data that i have selected in month slicer
                   Consumption Dollars PM is the previous month of the selected month
1.PNG
But when i select 2 months like May+June it is showing May+June data instead March+April.
So my requirement is when i select 2 or 3 months it should show the previous 2 or 3 months data those are not in the selections.
please help me get my requirement.
2.jpg
1 ACCEPTED SOLUTION
AnkitBI
Solution Sage
Solution Sage

You can try something like below. 

-- COUNTROWS(ALLSELECTED(DimDate[EnglishMonthName]))- Is to get count of selected months. This will return blank as period if no month is selected.
Consumption Dollars PM = CALCULATE([Consumption Dollars],PARALLELPERIOD(DimDate[FullDateAlternateKey],-COUNTROWS(ALLSELECTED(DimDate[EnglishMonthName])),MONTH))

 

Thanks
Ankit Jain

Do Mark it as solution if the response resolved your problem. Do like the response if it seems good and helpful.

View solution in original post

2 REPLIES 2
AnkitBI
Solution Sage
Solution Sage

You can try something like below. 

-- COUNTROWS(ALLSELECTED(DimDate[EnglishMonthName]))- Is to get count of selected months. This will return blank as period if no month is selected.
Consumption Dollars PM = CALCULATE([Consumption Dollars],PARALLELPERIOD(DimDate[FullDateAlternateKey],-COUNTROWS(ALLSELECTED(DimDate[EnglishMonthName])),MONTH))

 

Thanks
Ankit Jain

Do Mark it as solution if the response resolved your problem. Do like the response if it seems good and helpful.

Anonymous
Not applicable

@AnkitBI Thank you so much Ankit its working..

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.