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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.