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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

To get total customer number as the count of max date for that particular year

Hi everyone,

 

I have following table and a calendar date table which is linked to this table so that I can use time intelligent function. I have a line graph to show number of customers for each supplier which can be drilled up and down for year and quarter respectively.  I have a problem in showing yearly data. Suppose these are the time period- 2018Q1, 2018Q2, 2018Q3, 2018Q4, currently I am using Avg of  (2018Q1, 2018Q2, 2018Q3, 2018Q4) Customer number to show yearly data but ideally I should use 2018Q4 count as the total customer count of 2018.  There is an option for Max but is taking max count of customer number.  Is there any way to show annual data as Q4 count of each year as total customer for that year.

 

Any help would be greatly appreciated.

 

SupplierCustomerNumberTypeDateMarket
A5077type101 January 2017MarketA
A7383type101 April 2017MarketA
A2643type101 July 2017MarketA
A9171type101 October 2017MarketA
A9807type101 January 2018MarketA
A2066type101 April 2018MarketA
A7441type101 July 2018MarketA
A3684type101 October 2018MarketA
B2697type101 January 2017MarketA
B9423type101 April 2017MarketA
B8912type101 July 2017MarketA
B8820type101 October 2017MarketA
B6919type101 January 2018MarketA
B5240type101 April 2018MarketA
B7586type101 July 2018MarketA
B1965type101 October 2018MarketA
A1008type201 January 2017MarketA
A5377type201 April 2017MarketA
A1108type201 July 2017MarketA
A9639type201 October 2017MarketA
A2454type201 January 2018MarketA
A4162type201 April 2018MarketA
A1405type201 July 2018MarketA
A1015type201 October 2018MarketA
A4593type201 January 2017MarketB
A9068type201 April 2017MarketB
A9146type201 July 2017MarketB
A4568type201 October 2017MarketB
A7872type201 January 2018MarketB
A1363type201 April 2018MarketB
A6326type201 July 2018MarketB
A5977type201 October 2018MarketB
B6008type201 January 2017MarketA
B7547type201 April 2017MarketA
B6961type201 July 2017MarketA
B5514type201 October 2017MarketA
B6241type201 January 2018MarketA
B2137type201 April 2018MarketA
B2010type201 July 2018MarketA
B8822type201 October 2018MarketA
B2877type201 January 2017MarketB
B4108type201 April 2017MarketB
B7753type201 July 2017MarketB
B5808type201 October 2017MarketB
B4608type201 January 2018MarketB
B7934type201 April 2018MarketB
B6323type201 July 2018MarketB
B7571type201 October 2018MarketB
1 ACCEPTED SOLUTION

 

Hi @Anonymous ,

 

 

Please use below measure

 

Measure 7 = CALCULATE(SUM(Supplier[CustomerNumber]),FILTER(Supplier,Supplier[Date] = MAx(Supplier[Date])))
 
 
1.jpg2.JPG3.JPG
 
Regards,
Harsh Nathani
 
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!

View solution in original post

9 REPLIES 9
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Your requirement is not very clear, but you can try this.

 

Measure 8 = CALCULATE(Count(Supplier[CustomerNumber]))
 
123.JPG
 
If this is not whatyou are looking for please share expected output. Also Data is very symettrical, please share some variations. For e.g 3 in each quarter, 12 in the year.
 
Regards,
Harsh Nathani
 
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!
Anonymous
Not applicable

Hi @harshnathani ,

 

Apologies that the question is not clear. I am plotting a line graph with date hierarchy. When I drill up to show yearly data, it sums up all the quarters data of that year. 

 

quarterLine.PNGyearLine.PNG

 

When we look at the yearly representation it is adding quarterly data. For ex- 2017, the total customer count for 2017 is sum of 2017Q1+2017Q2+2017Q3+2017Q4. 

My requirement is the total customer count for 2017 should be the value of 2017Q4 instead of the summation of all quarters i.e total customer count for 2017 should be 17355 and not 69615. 

 

Sample data-

SupplierCustomerNumberTypeDateMarketQuarter
A17718type101 January 2017MarketA2017Q1
A17435type101 April 2017MarketA2017Q2
A17107type101 July 2017MarketA2017Q3
A17355type101 October 2017MarketA2017Q4
A17262type101 January 2018MarketA2018Q1
A17214type101 April 2018MarketA2018Q2
A17261type101 July 2018MarketA2018Q3
A17094type101 October 2018MarketA2018Q4
B1047type101 January 2017MarketA2017Q1
B1057type101 April 2017MarketA2017Q2
B1037type101 July 2017MarketA2017Q3
B1003type101 October 2017MarketA2017Q4
B939type101 January 2018MarketA2018Q1
B904type101 April 2018MarketA2018Q2
B947type101 July 2018MarketA2018Q3
B1091type101 October 2018MarketA2018Q4
A1137411type201 January 2017MarketA2017Q1
A1130613type201 April 2017MarketA2017Q2
A1125576type201 July 2017MarketA2017Q3
A1123080type201 October 2017MarketA2017Q4
A1117091type201 January 2018MarketA2018Q1
A1110150type201 April 2018MarketA2018Q2
A1103428type201 July 2018MarketA2018Q3
A1100443type201 October 2018MarketA2018Q4
A144675type201 January 2017MarketB2017Q1
A141492type201 April 2017MarketB2017Q2
A140707type201 July 2017MarketB2017Q3
A140527type201 October 2017MarketB2017Q4
A140112type201 January 2018MarketB2018Q1
A139111type201 April 2018MarketB2018Q2
A139257type201 July 2018MarketB2018Q3
A140821type201 October 2018MarketB2018Q4
B328620type201 January 2017MarketA2017Q1
B332214type201 April 2017MarketA2017Q2
B332274type201 July 2017MarketA2017Q3
B330460type201 October 2017MarketA2017Q4
B331836type201 January 2018MarketA2018Q1
B337319type201 April 2018MarketA2018Q2
B342262type201 July 2018MarketA2018Q3
B348809type201 October 2018MarketA2018Q4
B327407type201 January 2017MarketB2017Q1
B323176type201 April 2017MarketB2017Q2
B316837type201 July 2017MarketB2017Q3
B311380type201 October 2017MarketB2017Q4
B307854type201 January 2018MarketB2018Q1
B305528type201 April 2018MarketB2018Q2
B303806type201 July 2018MarketB2018Q3
B304366type201 October 2018MarketB2018Q4

 

Hi @Anonymous ,

 

 

Please use below measure

 

Measure 7 = CALCULATE(SUM(Supplier[CustomerNumber]),FILTER(Supplier,Supplier[Date] = MAx(Supplier[Date])))
 
 
1.jpg2.JPG3.JPG
 
Regards,
Harsh Nathani
 
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!
Anonymous
Not applicable

Hi @harshnathani ,

 

The solution worked like a charm. With the help of this I am able to calculate YoY and QoQ percentage change correctly. However, I am trying to  find the overall percentage share as per the selected data but not getting the desired result.

 

Earlier I used this measure-

SupplierPctAllSe = DIVIDE(SUM(ElectricityGasCustomerNum[CustomerNumber]),CALCULATE(SUM(ElectricityGasCustomerNum[CustomerNumber]), ALLSELECTED(('ElectricityGasCustomerNum'))))

 

share.PNG

Hi @Anonymous ,

 

Sorry typing this from my mobile.

 

But use ALL instead for ALLSelected for overall percentage.

 

Regards

Harsh Nathani

Anonymous
Not applicable

Hi @harshnathani ,

 

I actually want to use Allselected so that the data that is selected from the slicer is used as 100%. The desired result is in the screenshot provided.

 

Regards,

Supriya

Hi @Anonymous ,

 

Please use the following measures.

 

SUM_SUPPLIER = SUM(Supplier[CustomerNumber])
 
Total_Sum_Supplier = CALCULATE(SUM(Supplier[CustomerNumber]),ALLSELECTED(Supplier))   ----> Supplier is Name of the Table
 
PercentageSS = DIVIDE([SUM_SUPPLIER],[Total_Sum_Supplier],0)
 
 
123.JPG
 
Regards,
Harsh Nathani
 
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!
Anonymous
Not applicable

Why is

distinctcount(Supplier[CustomerNumber])

not good? This is the exact number of customers in any period of time. Why would you want to calculate the yearly figure as the Q4 figure? That makes no sense.

Best
D

I believe this measure will get you the desired result.  It calculates the sum for the last quarter (alphabetically) in any context.   When you are drilled down to quarter it still works.

 

LastQuarterCount = CALCULATE(SUM(Data[CustomerNumber]), TOPN(1, VALUES(Data[Quarter]), Data[Quarter],DESC))
 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.