Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I have two columns of data - the first is a status column, the second is site name.
I want to calculate the rate of each status by total number of rows for each site. There are only 4 status's but there are 27 sites! Is there a quick way with DAX to calculate #status divided by total rows for each site, without having to manually create measures for each site?
Best,
Soph
Solved! Go to Solution.
Hi @SophRow ,
I have created a simple sample, please refer to my pbix file to see if it helps you.
Create a measure.
Measure =
VAR _site =
CALCULATE (
COUNT ( 'Table'[site name] ),
FILTER (
ALL ( 'Table' ),
'Table'[site name] = SELECTEDVALUE ( 'Table'[site name] )
)
)
VAR _status =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALL ( 'Table' ),
'Table'[status] = SELECTEDVALUE ( 'Table'[status] )
&& 'Table'[site name] = SELECTEDVALUE ( 'Table'[site name] )
)
)
RETURN
_status / _site
Or a column.
Column =
VAR _site =
CALCULATE (
COUNT ( 'Table'[site name] ),
FILTER ( ALL ( 'Table' ), 'Table'[site name] = EARLIER ( 'Table'[site name] ) )
)
VAR _status =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALL ( 'Table' ),
'Table'[status] = EARLIER ( 'Table'[status] )
&& 'Table'[site name] = EARLIER ( 'Table'[site name] )
)
)
RETURN
_status / _site
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks so much for helping Polly!
What I'm trying to create is similar to the below to tease out each status per total visits rather than per randomised participant:
Do you know how I could do that with your measure?
Best wishes,
Soph
Hi @SophRow ,
How to tease out each status per total visits ? Could you please provide some sample data and your desired output?
please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Polly - I figured it out! Thanks again for your help - that measure is awesome
Hi @SophRow ,
I have created a simple sample, please refer to my pbix file to see if it helps you.
Create a measure.
Measure =
VAR _site =
CALCULATE (
COUNT ( 'Table'[site name] ),
FILTER (
ALL ( 'Table' ),
'Table'[site name] = SELECTEDVALUE ( 'Table'[site name] )
)
)
VAR _status =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALL ( 'Table' ),
'Table'[status] = SELECTEDVALUE ( 'Table'[status] )
&& 'Table'[site name] = SELECTEDVALUE ( 'Table'[site name] )
)
)
RETURN
_status / _site
Or a column.
Column =
VAR _site =
CALCULATE (
COUNT ( 'Table'[site name] ),
FILTER ( ALL ( 'Table' ), 'Table'[site name] = EARLIER ( 'Table'[site name] ) )
)
VAR _status =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALL ( 'Table' ),
'Table'[status] = EARLIER ( 'Table'[status] )
&& 'Table'[site name] = EARLIER ( 'Table'[site name] )
)
)
RETURN
_status / _site
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
84 | |
84 | |
72 | |
49 |
User | Count |
---|---|
143 | |
131 | |
109 | |
64 | |
55 |