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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Prathyush
Frequent Visitor

Issue in Comparing Prior Period Sales

Hi Everyone,

I am new to Power BI , I Need an assistance in Comparing the previous Period Sale with Last To last Month Sale. 

In my Scenario If current monthis april,  user has to take prvious month Sale and Compare it with selected periods prior to March.

 

My Last month Sale is  Working Fine

Last Period Sale = CALCULATE(SUM('fact SalesInvoice'[SalesAmountBase])+SUM('fact SalesInvoice'[DiscountAmountEndBase]),FILTER('dim Date','dim Date'[rank]='dim Date'[CurrentMonthRank]-1 ))

 

-->  I used a Rank Column for Month-Year  using Rankx for Ranking the Prior Months

 

My selected period Sale is working Fine

Selected Period Sale = CALCULATE(SUM('fact SalesInvoice'[SalesAmountBase])+SUM('fact SalesInvoice'[DiscountAmountEndBase]),FILTER('dim Date','dim Date'[rank]<='dim Date'[CurrentMonthRank]-2 && 'dim Date'[rank]>=('dim Date'[CurrentMonthRank]-1)-[Selected Period]))

 

Now I pulled Selected Period Sale and customers to a bar chart and a table, and put visual level filter that Last Period Sale <=0 to find Lost Customers in Last Period Compared to selected Period.

 

My Report is also looking Fine.

Report.png

But When I Add Product Code Also as a Row in Table Visual, It shows Another List Of Customer which are not lost Customers.

Please see the below results Which is wrong.

 

 

 Report3.png

Urgent Assistance is Appreciated....

 

Thanks

Prathyush

 

 

2 REPLIES 2
v-qiuyu-msft
Community Support
Community Support

Hi @Prathyush,

 

Is [Product Code] field comes from the same table "fact SalesInvoice"? Would you please share some sample data? If possible please share your .pbix file for our analysis.

 

Best Regards,
Qiuyun Yu

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

Hi Qiuyun,

 

Yes it is from fact Sales invoice.Please find samle data from fact sales invoice.

 

SellToCustomerIDBillToCustomerIDDocumentSalesIDDocumentSalesLineIDChargesIDFinancialDimension1IDFinancialDimension2IDFinancialDimension3IDFinancialDimension4IDFinancialDimension5IDFinancialDimension6IDFinancialDimension7IDFinancialDimension8IDFinancialDimension9IDFinancialDimension10IDFinancialDimension11IDFinancialDimension12IDFinancialDimension13IDFinancialDimension14IDFinancialDimension15IDItemDimension1IDItemDimension2IDItemDimension3IDItemIDInventoryDimensionIDInventoryBatchIDInventorySerialIDInventorySizeIDPostingDateIDReasonCodeIDEmployeeIDCommissionSalesGroupIDReturnReasonCodeIDCurrencyIDGlobalDocumentNoIDGeneralTypeIDProcurementCategoryIDItemLedgerEntryNoValueEntryNoDocumentTypeInvoicedQuantityShippedQuantitySalesAmountPostedDiscountAmountPostedLineDiscountAmountPostedDiscountPercentAmountPostedCostAmountPostedCommissionAmountPostedMiscChargesPostedSumTaxPostedSalesAmountBaseDiscountAmountBaseLineDiscountAmountBaseDiscountPercentAmountBaseCostAmountBaseCommissionAmountBaseMiscChargesBaseSumTaxBaseSalesAmountACYDiscountAmountACYLineDiscountAmountACYDiscountPercentAmountACYCostAmountACYCommissionAmountACYMiscChargesACYSumTaxACYDiscountAmountEndPostedMiscChargesEndPostedDiscountAmountEndBaseMiscChargesEndBaseDiscountAmountEndACYMiscChargesEndACYRebatePerUnitRebateFixedAmountRebatePercentageRebatePerUnitBaseRebateFixedAmountBaseRebatePercentageBaseRebatePerUnitACYRebateFixedAmountACYRebatePercentageACYChargesValueDateNoCompanyIDStageTimestampLoadIDSalesPersonIDdim.Chargesdim.CommissionSalesGroupdim.Companydim.Currencydim.Datedim.DocumentSalesdim.DocumentSalesLinedim.Employeedim.FinancialDimension1dim.FinancialDimension10dim.FinancialDimension11dim.FinancialDimension12dim.FinancialDimension13dim.FinancialDimension14dim.FinancialDimension15dim.FinancialDimension2dim.FinancialDimension3dim.FinancialDimension4dim.FinancialDimension5dim.FinancialDimension6dim.FinancialDimension7dim.FinancialDimension8dim.FinancialDimension9dim.GeneralTypedim.GlobalDocumentNodim.InventoryBatchdim.InventoryDimensionsdim.InventorySerialdim.InventorySizedim.Itemdim.ItemDimension1dim.ItemDimension2dim.ItemDimension3dim.ProcurementCategorydim.ReasonCodedim.ReturnReasonCode
24832483109610022899280000000000000000000313996921000020170402000023497625105643938121563943255532217.200011.99800017.200011.99800017.200011.9980000000000000000000428252Binary.FromText(...)7300                                    
3187318713512862328934000000000000000000059256921000020170411000023509963105643979443563944684135050975000687.401000975000687.401000975000687.4010000000000000000000428342Binary.FromText(...)7371                                    
318731871351286232893500000000000000000001966069210000201704110000235099631056439794445639446841355525000418.523000525000418.523000525000418.5230000000000000000000428342Binary.FromText(...)7371                                    
3119311918409542330530000000000000000000026046921000020170411000023510531105643980699563944733538813600091.39400013600091.39400013600091.3940000000000000000000428342Binary.FromText(...)7371                                    

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.