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
deepvibha
Advocate II
Advocate II

Value summation by date

Hello,

 

I have a table as follows:

 

DateDepartmentReceivedWithin 24 hrsWithin 48 hrs
07-11-16Cornea723
07-11-16Glaucoma1032
07-11-16Retina843
07-11-16Cataract812
14-11-16Cornea1051
14-11-16Glaucoma1033
14-11-16Retina741
14-11-16Cataract822

 

The need is to have % of requests resolved within 24 hrs and 48 hrs, by department and date. For example:

For date 07-11-16 and Cornea department, 29% requests are resolved within 24hrs (2 divided by 7) and 43% requests are resolved within 48hrs (3 divided by 7).

 

I have imported the table in PBI and have unpivoted the columns, which looks as follows:

OP.png

 

I am also trying to create a column "Cornea24hrs" as seen in the figure, which is not successful.

 

Your help by way of detailed steps would be much appreciated.

 

Thanks a ton.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @deepvibha

 

Just change the measures as follows and rest remaining the same as my previous reply

 

Create Measures - SumReceived, Sum24Hrs, Sum48Hrs as follows

    SumReceived = Calculate(sum (FactTable[Received]),FactTable[Attribute] = "Received")

    Sum24Hrs = Calculate(sum (FactTable[Received]),FactTable[Attribute] = "Within 24 Hrs")

    Sum48Hrs = Calculate(sum (FactTable[Received]),FactTable[Attribute] = "Within 48 Hrs")

 

This should work.

 

If this works please accept it as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

View solution in original post

Anonymous
Not applicable

Hi @deepvibha

 

You will not be ablt to expactly replicate the excel output in Power BI.

 

There are two approaches possible.

 

1. Create a column called DateByDepartment =  Format([TransDate],"DD/MM/YYYY") & "-" & [Department]

2. Use this as a x-axis and then the measures 24hrs% and 48hrs% as Y-axis.

 

The out put will look like

 

                                 

 

                     

Capture.GIF

 

The x-axis will look like

                         Capture.GIF

Very close to Excel

 

The second approach is to create a hierarchy

1. Right click on the Date column of your table and select NewHierarchy

2. Drag the Department also under this.

3. Rename this hierarchy as TransDateDepartment

4. Use this as x-axis and the measures as y-axis.

5. The chart will initially look like

    Capture.GIF

6. Click on the weighing scale like icon you will see the output as

 

Capture.GIF

 

 When you click on the two down arrows icon you will get it at Department level.

 

 

If this works give additonal KUDOS.

 

Cheers

 

CheenuSing

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @deepvibha

 

Please try the following steps :

 

1. Create Measures - SumReceived, Sum24Hrs, Sum48Hrs as follows

    SumReceived = Sum(FactTable[Received])

    Sum24Hrs = sum (FactTable[Within 24 hrs])

    Sum48Hrs = sum (FactTable[Within 48 hrs])

 

2. Now create the measure %24Hrs, %48Hrs

   %24hrs = divide ([Sum24Hrs],[SumReceived])

   %48hrs = divide ([Sum48Hrs],[SumReceived])

 

3. Make these two % measures as data type perccentage.

 

4. You should get what you wanted, see the screen shot.

 

Capture.GIF

 

If this works for you please accept it as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

Thanks @Anonymous

 

 

The solution given is for pivoted table.

 

 

I am looking for a solution for an unpivoted table.

 

Regards,

Deepak

Anonymous
Not applicable

Hi @deepvibha

 

Can you explain what you mean by unpivoted table and the output you desire.

 

Cheers

 

CheenuSing

Thanks for a spontenous reply @Anonymous

 

As I understand, the pivoted table is as under:

 

DateDepartmentReceivedWithin 24 hrsWithin 48 hrs
07-11-16Cornea723
07-11-16Glaucoma1032
07-11-16Retina843
07-11-16Cataract812
14-11-16Cornea1051
14-11-16Glaucoma1033
14-11-16Retina741
14-11-16Cataract822

 

 

Whereas an unpivoted table is as under, which is the format for a database :

DateDepartmentAttributeReceived
07-11-16CorneaReceived7
07-11-16CorneaWithin 24 hrs2
07-11-16CorneaWithin 48 hrs3
07-11-16GlaucomaReceived10
07-11-16GlaucomaWithin 24 hrs3
07-11-16GlaucomaWithin 48 hrs2
07-11-16RetinaReceived8
07-11-16RetinaWithin 24 hrs4
07-11-16RetinaWithin 48 hrs3
07-11-16CataractReceived8
07-11-16CataractWithin 24 hrs1
07-11-16CataractWithin 48 hrs2
14-11-16CorneaReceived10
14-11-16CorneaWithin 24 hrs5
14-11-16CorneaWithin 48 hrs1
14-11-16GlaucomaReceived10
14-11-16GlaucomaWithin 24 hrs3
14-11-16GlaucomaWithin 48 hrs3
14-11-16RetinaReceived7
14-11-16RetinaWithin 24 hrs4
14-11-16RetinaWithin 48 hrs1
14-11-16CataractReceived8
14-11-16CataractWithin 24 hrs2
14-11-16CataractWithin 48 hrs2

 

So far as the data is pulled from Excel, we can have the % in Excel columns and there is no need of calculating it in PBI. But what is the same data is pulled from Database?

 

My requirement is to have the % of patients requests resolved within 24 hrs and 48 hrs, by date & department. 

 

For example, on "Date" 07-11-16 I have received 7 requests for "Cornea" department of which 2 were resolved withing 24 hrs ( 29%, 2 divided by 7) and 3 were resolved within 48 hrs (43%, 3 divided by 7)

 

Similarly, for all departments for 07-11-16 and for 14-11-16.

 

I hope I have put in my requirement more elaboratly. 

 

Regards,

Deepak

 

 

Anonymous
Not applicable

Hi @deepvibha

 

Just change the measures as follows and rest remaining the same as my previous reply

 

Create Measures - SumReceived, Sum24Hrs, Sum48Hrs as follows

    SumReceived = Calculate(sum (FactTable[Received]),FactTable[Attribute] = "Received")

    Sum24Hrs = Calculate(sum (FactTable[Received]),FactTable[Attribute] = "Within 24 Hrs")

    Sum48Hrs = Calculate(sum (FactTable[Received]),FactTable[Attribute] = "Within 48 Hrs")

 

This should work.

 

If this works please accept it as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

Thanks a Ton @Anonymous,

 

The solution worked.....

 

The next challenge is to have both "Department" by "Date". The graph should reflect all the departments against the given dates. Like the chart below, which is plotted in MS Excel.

 

ExcelChart.png

 

But when doing it in PBI, I am unable achieve the same results.

 

OP.png

 

Would appreciate help on this...

 

Regards,

Deepak

 

Anonymous
Not applicable

Hi @deepvibha

 

You will not be ablt to expactly replicate the excel output in Power BI.

 

There are two approaches possible.

 

1. Create a column called DateByDepartment =  Format([TransDate],"DD/MM/YYYY") & "-" & [Department]

2. Use this as a x-axis and then the measures 24hrs% and 48hrs% as Y-axis.

 

The out put will look like

 

                                 

 

                     

Capture.GIF

 

The x-axis will look like

                         Capture.GIF

Very close to Excel

 

The second approach is to create a hierarchy

1. Right click on the Date column of your table and select NewHierarchy

2. Drag the Department also under this.

3. Rename this hierarchy as TransDateDepartment

4. Use this as x-axis and the measures as y-axis.

5. The chart will initially look like

    Capture.GIF

6. Click on the weighing scale like icon you will see the output as

 

Capture.GIF

 

 When you click on the two down arrows icon you will get it at Department level.

 

 

If this works give additonal KUDOS.

 

Cheers

 

CheenuSing

That worked @Anonymous

Thanks...

Regards,

Deepak

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors