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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.