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

Calculate L6M Score and then its Quarter Average

Hi,

I am trying to calcualte a L6M(Last 6 Monts) Score:

KPI_Store Purchase Freq (L6M) =
SUMX(
SUMMARIZE(
factSO
,factSO[StartOfMonth]
,"InvoiceCount"
,CALCULATE([BIT_Invoice Count (Distinct)],ALLSELECTED(factSO[StartOfMonth]),DATESINPERIOD(dimCalendar[Date], EOMONTH(MAX(factSO[StartOfMonth]),0),-6,MONTH))
,"CustomerCount"
,CALCULATE([BIT_Customer Count (Distinct)],ALLSELECTED(factSO[StartOfMonth]),DATESINPERIOD(dimCalendar[Date], EOMONTH(MAX(factSO[StartOfMonth]),0),-6,MONTH))
), DIVIDE([InvoiceCount] ,[CustomerCount] ,0)
)

If i check this sumarize as table it gives me corect numbers i.e. final score for a month would be InvoiceCount/CustomerCount which will be the result for SUMX:

L6M Calculation.png

But when i am trying to plot the Score(in a matrix/table) against the Months from Calender table it filters the data itself for the specific Month and calcualtes the score according to that filtered data i.e. one month.

L6M Calculation Table View.png

 

 

 

 

This is my problem statement:

1) I want to show L6M score for all the months

2) I also have to calculate average scores for quarters as well e.g. (Dec Score[Data: July to Dec] + Nov Score[June to Nov] + Oct Score[May to Oct])/3 and show under 1 column e.g. Q4

 

Help me out.

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the input guys.

Found a solution by creating the Bridge Table (kind of cartesian):

L6MBridge.png

and connected Date_Calender to calender date and Date_FactData to fact data date.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

I did not get it completely. But can remove max inside the EOMONTH and try like

 

Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-6,MONTH))  

 

 

Anonymous
Not applicable

for Monthly Value:

Without removeing MAX from the measure, if i am ploting the L6M Measure against the date(i.e. First Date of Month) from fact table it is working fine if the date ascending. but if i am sorting the date descending then the measure value is using only one month date for L6M Measure calculation.

@Anonymous 

 

You may check if the following post helps.

https://community.powerbi.com/t5/Desktop/Sort-By-Column-changes-the-Measure-results/m-p/91258#M38515

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for the input guys.

Found a solution by creating the Bridge Table (kind of cartesian):

L6MBridge.png

and connected Date_Calender to calender date and Date_FactData to fact data date.

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.