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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.