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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
JIGAR
Resolver IV
Resolver IV

Help Writing a Measure

Hello,

 

I need some help with writing a measure to get the specific desired result.

 

Please find below the raw data along with the output that I am looking for.

 

Raw Data : 

 

DateNameHoursCategory
1/3/2020Sam7.5Cat 1
1/2/2020Sam7.5Cat 1
1/4/2020Sam5Cat 1
1/4/2020Sam5Cat 2
1/4/2020Sam5Cat 3
1/4/2020Sam5Cat 4
1/4/2020Sam5Cat 5
1/4/2020Sam5Cat 6
1/2/2020Sam7.5Cat 3
1/2/2020Sam7.5Cat 7
1/3/2020Sam7.5Cat 8
1/3/2020Sam7.5Cat 9
1/3/2020Sam7.5Cat 10
1/3/2020Sam7.5Cat 6
1/2/2020Sam7.5Cat 6
1/3/2020Sam7.5Cat 11
1/3/2020Sam7.5Cat 3
1/2/2020Sam7.5Cat 2
1/3/2020Sam7.5Cat 2

 

 

Desired Output :

 

Output 
  
NameTotal Hours
Sam20
Cat 120
Cat 220
Cat 320
Cat 420
Cat 520
Cat 620
Cat 720
Cat 820
Cat 920
Cat 1020
Cat 1120
Total 20

 

Output I am getting (This is incorrect)

 

NameTotal Hours
Sam20
Cat 120
Cat 220
Cat 320
Cat 45
Cat 55
Cat 620
Cat 77.5
Cat 87.5
Cat 97.5
Cat 107.5
Cat 117.5
Total 20

 

The measure that I am looking for should calculate the total no. of hours based on the dates irrespective of task category. 

 

Any help on this would be highly appreciated

 

Thank you

2 REPLIES 2
Anonymous
Not applicable

 

Pull below measure in your Visual:

 

 

SumOfHours=CALCULATE(SUM(Table[Hours]),ALL(Table[Category]))

 

 

 

jthomson
Solution Sage
Solution Sage

Start by explaining the logic that gives, say, Cat 7 = 20. There's one line for Cat 7, and it says 7.5.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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