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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Count and sum of multiple market models

So I need to do a count & sum on models that are present in mutliple markets. 

For example: 

SSSTE_0-1656320565693.png

I tried creating a measure without ALL to remove the filters, and based on that doing the count/sum, but it seems I'm still missing.  Does anyone have any guidance on how to resolve this? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Solution: 

Test =
VAR countryModel =
FILTER(
SUMMARIZECOLUMNS(
'Model'[Model],
"Count", DISTINCTCOUNT('Model'[Country])
),
[Count] > 1
)
 
VAR Result = IF( ISBLANK(COUNTROWS(countryModel)),"No Matches Found",COUNTROWS(countryModel))

RETURN Result
 
Test2 =
VAR countryModel =
FILTER(
SUMMARIZECOLUMNS(
'Model'[Model],
"Count", DISTINCTCOUNT('Model'[Country])
),
[Count] > 1
)
 
VAR Result =
CALCULATE(
SUMX(
'Model',
[Sales volume]),
FILTER(
countryModel,
[Model] = 'Model'[Model]
)
)
RETURN Result
 
Test3 =
VAR Result = COUNTROWS('Model')

RETURN Result

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Solution: 

Test =
VAR countryModel =
FILTER(
SUMMARIZECOLUMNS(
'Model'[Model],
"Count", DISTINCTCOUNT('Model'[Country])
),
[Count] > 1
)
 
VAR Result = IF( ISBLANK(COUNTROWS(countryModel)),"No Matches Found",COUNTROWS(countryModel))

RETURN Result
 
Test2 =
VAR countryModel =
FILTER(
SUMMARIZECOLUMNS(
'Model'[Model],
"Count", DISTINCTCOUNT('Model'[Country])
),
[Count] > 1
)
 
VAR Result =
CALCULATE(
SUMX(
'Model',
[Sales volume]),
FILTER(
countryModel,
[Model] = 'Model'[Model]
)
)
RETURN Result
 
Test3 =
VAR Result = COUNTROWS('Model')

RETURN Result

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.