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
chchIntech
Frequent Visitor

Calculate Qty Sold Month by Month by account/product/colour/price

Hi Everyone,

 

We are trying to show qty sold month by month by account/product/color/price in a table. 

 

We are using the current DAX: 

 

Current Month =
CALCULATE(
SUM(Sales[Quantity]),
PARALLELPERIOD(Dates[Date], -0,MONTH)) -
CALCULATE(
SUM(Sales[Quantity]),
PARALLELPERIOD(Dates[Date], -1,MONTH))

 

One Month Ago=
CALCULATE(
SUM(Sales[Quantity]),
PARALLELPERIOD(Dates[Date], -1,MONTH)) -
CALCULATE(
SUM(Sales[Quantity]),
PARALLELPERIOD(Dates[Date], -2,MONTH))

 

and so on up until six months. 

 

We get the totals right for all the months, but the values displayed within the table (row level) are not for all the months. What are we doing wrong? What are we missing on?

 

Current Month - Expected Result

current month.JPG

 

 

 

 

 

 

 

 

 

Power BI Current Month: Total is correct, but not at row level:

current month PBI.JPG

 

Any idea what are we missing on? Any help would be much appreciated. 

 

Data Relationships:

data setup.JPG

 

Thanks

Intech

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi @chchIntech ,

 

Please replace PARALLELPERIOD with DATESINPERIOD function for a test. Refer to this document for detailed syntax.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.