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
InsightSeeker
Helper III
Helper III

Help on Measure

How can I calculate online / offline % from my data by using a measure?

 

Table 1

Name

Unique

Status

Apple

1

Offline

Apple

2

Online

Apple

3

Online

Grapes

4

Online

Grapes

5

Offline

Grapes

6

Offline

Carrot

7

Online

Carrot

8

Online

 

 

Table 2 (Result)

Name

Offline

Online

Grand Total

Apple

33%

67%

100%

Grapes

67%

33%

100%

Carrot

0%

100%

100%

Grand Total

38%

63%

100%

 

 

2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

Hi @InsightSeeker 

 

Download PBIX file with these examples

 

Use these measures

 

 

Online = 

VAR _Rows = CALCULATE(COUNTROWS('DataTable'), FILTER(ALL('DataTable'), 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

VAR _OnlineRows = CALCULATE(COUNTROWS('DataTable'), FILTER((ALL('DataTable')), 'DataTable'[Status] = "Online" && 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

RETURN

DIVIDE(_OnlineRows, _Rows) + 0

 

 

 

Offline = 

VAR _Rows = CALCULATE(COUNTROWS('DataTable'), FILTER(ALL('DataTable'), 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

VAR _OfflineRows = CALCULATE(COUNTROWS('DataTable'), FILTER((ALL('DataTable')), 'DataTable'[Status] = "Offline" && 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

RETURN

DIVIDE(_OfflineRows, _Rows) + 0

 

 

onoff.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

KRISHP1234
Helper I
Helper I

KRISHP1234_0-1714469616475.png

Try This measure.

 

View solution in original post

2 REPLIES 2
KRISHP1234
Helper I
Helper I

KRISHP1234_0-1714469616475.png

Try This measure.

 

PhilipTreacy
Super User
Super User

Hi @InsightSeeker 

 

Download PBIX file with these examples

 

Use these measures

 

 

Online = 

VAR _Rows = CALCULATE(COUNTROWS('DataTable'), FILTER(ALL('DataTable'), 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

VAR _OnlineRows = CALCULATE(COUNTROWS('DataTable'), FILTER((ALL('DataTable')), 'DataTable'[Status] = "Online" && 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

RETURN

DIVIDE(_OnlineRows, _Rows) + 0

 

 

 

Offline = 

VAR _Rows = CALCULATE(COUNTROWS('DataTable'), FILTER(ALL('DataTable'), 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

VAR _OfflineRows = CALCULATE(COUNTROWS('DataTable'), FILTER((ALL('DataTable')), 'DataTable'[Status] = "Offline" && 'DataTable'[Name] = SELECTEDVALUE('DataTable'[Name])))

RETURN

DIVIDE(_OfflineRows, _Rows) + 0

 

 

onoff.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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.