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

Need help for total by month and year

Hi All,

 

I am struggling to find a solution for the below scenario. As shown below I have the year, quarter and month columns and for each month I have (Low, Medium, High, Undetermined) indicators and the corresponding tasks. I would like to achieve the result of the 5th and 6th columns (I would like to create measures for this). For each year, I like to calculate the distinct number of months per year (which have tasks assigned). And the 6th column would be the total number of tasks for that year, And the last column will be the result of "Sum of tasks yearly/Desired Measure(For Months)"

 

YearQuarterMonthIndicatorTasksDesired Measure(For Months)Sum of tasks yearlyAverage
2018Qtr 4OctoberLow1231.5
2018Qtr 4OctoberHigh1231.5
2018Qtr 4NovemberLow1231.5
2019Qtr 1JanuaryLow53289.333333
2019Qtr 1JanuaryMedium13289.333333
2019Qtr 1JanuaryHigh13289.333333
2019Qtr 1JanuaryUndetermined23289.333333
2019Qtr 1FebruaryLow23289.333333
2019Qtr 1FebruaryMedium13289.333333
2019Qtr 1FebruaryHigh23289.333333
2019Qtr 1MarchLow53289.333333
2019Qtr 1MarchMedium23289.333333
2019Qtr 1MarchHigh63289.333333
2019Qtr 1MarchUndetermined13289.333333

 

Any help much appreciated!

 

Thanks,

Sam

1 ACCEPTED SOLUTION
sam021083
Frequent Visitor

After going through other help topics, I was able to find the solution. 

The below measure will provide the correct results. However, if we have any blank values in any of the columns this will formulae doesn't work and we need to add a filter condition in place 'ALL'.

 

Measure = CALCULATE(DISTINCTCOUNT(Table1[Month]),ALL(Table1),VALUES(Table1[Year]))
 
 
Thanks,
Sam

View solution in original post

2 REPLIES 2
sam021083
Frequent Visitor

After going through other help topics, I was able to find the solution. 

The below measure will provide the correct results. However, if we have any blank values in any of the columns this will formulae doesn't work and we need to add a filter condition in place 'ALL'.

 

Measure = CALCULATE(DISTINCTCOUNT(Table1[Month]),ALL(Table1),VALUES(Table1[Year]))
 
 
Thanks,
Sam
parry2k
Super User
Super User

@sam021083 add following 3 measures

 

Distinct Month Count = DISTINCTCOUNT( Table[Month] )

Tasks = SUM( Table[Tasks] )

Avg = DIVIDE( [Tasks], [Distinct Month Count] )

Drop a table visual and Year, and 3 new measures on values.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.