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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors