Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello
I'm trying to produce a measure that will calculate the sum of calls made by phone numbers that have called 6 or more times, I thought about maybe using VAR to create a virtual table of the count of each phone number and then filter that so its sums the ones with a count of 6 or more but I've not been able to get that to work but that could be due to my lack of knowledge in writing DAX. I need this measure to interact with a date slicer and to be able to use it to calculate the result as a percentage of all calls.
These are the columns in the data set
I've been able to create a visulization that gets me what I need, so I know what the outcome of the measure should be, this is just a count of the calling number with a filter to only show counts equal to or greater than 6, so essencially I need to recreate this table as a measure
Thanks in advance for your assistance
Solved! Go to Solution.
You could create a measure like
Num calls ( 6 or more ) =
VAR NumbersAndCalls =
ADDCOLUMNS (
VALUES ( 'Table'[Calling No] ),
"@num calls", CALCULATE ( COUNTROWS ( 'Table' ) )
)
VAR Result =
SUMX ( FILTER ( NumbersAndCalls, [@num calls] >= 6 ), [@num calls] )
RETURN
Result
and to show the %
Num calls ( 6 or more ) % =
DIVIDE ( [Num calls ( 6 or more )], COUNTROWS ( 'Table' ) )
@AllisonB Measure to count the number of calls per phone number:
CallsPerPhoneNumber =
CALCULATE(
COUNTROWS('YourTable'),
ALLEXCEPT('YourTable', 'YourTable'[Calling No])
)
Measure to filter and sum the calls for phone numbers with 6 or more calls:
SumOfCallsByFrequentCallers =
CALCULATE(
SUM('YourTable'[Duration]),
FILTER(
ADDCOLUMNS(
SUMMARIZE('YourTable', 'YourTable'[Calling No]),
"CallCount", [CallsPerPhoneNumber]
),
[CallCount] >= 6
)
)
Measure to calculate the percentage of these calls relative to all calls:
PercentageOfFrequentCalls =
DIVIDE(
[SumOfCallsByFrequentCallers],
SUM('YourTable'[Duration]),
0
)
Proud to be a Super User! |
|
You could create a measure like
Num calls ( 6 or more ) =
VAR NumbersAndCalls =
ADDCOLUMNS (
VALUES ( 'Table'[Calling No] ),
"@num calls", CALCULATE ( COUNTROWS ( 'Table' ) )
)
VAR Result =
SUMX ( FILTER ( NumbersAndCalls, [@num calls] >= 6 ), [@num calls] )
RETURN
Result
and to show the %
Num calls ( 6 or more ) % =
DIVIDE ( [Num calls ( 6 or more )], COUNTROWS ( 'Table' ) )
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |