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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors