The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have query with 3 dimensions (Continent/CountryRegion/City) part of paginated report.
I would like to highlight only those child groups where there is 1 item.
So I need to get a count of items per each parent group.
In this case, let's write the query, to be more exact.
EVALUATE
VAR __t1 =
SUMMARIZECOLUMNS (
Customer[Continent],
Customer[CountryRegion],
Customer[City],
"Amount", [Sales Amount]
)
RETURN
GROUPBY(
__t1,
Customer[Continent],
Customer[CountryRegion],
"Count" , countX(CURRENTGROUP(), Customer[CountryRegion] )
) ORDER BY Customer[Continent] DESC
Which brings me this
Result I am looking for is
And in a case where I have 3 dimensions
EVALUATE
VAR __t1 =
SUMMARIZECOLUMNS (
Customer[Continent],
Customer[CountryRegion],
Customer[City],
"Amount", [Sales Amount]
)
RETURN
GROUPBY(
__t1,
Customer[Continent],
Customer[CountryRegion],
Customer[City],
"Count" , countX(CURRENTGROUP(), Customer[City] )
) ORDER BY Customer[Continent] DESC
I get
But I would like to see
How should I approach this?
Thank you!
Thank you for your answer!
I've tried your query but it gives me an error
To achieve the desired result, you can use the following approach:
EVALUATE
VAR __t1 =
SUMMARIZECOLUMNS (
Customer[Continent],
Customer[CountryRegion],
Customer[City],
"Amount", [Sales Amount]
)
VAR __t2 =
SUMMARIZECOLUMNS (
__t1,
Customer[Continent],
Customer[CountryRegion],
"Count", COUNTROWS(__t1)
)
RETURN
GROUPBY(
__t2,
Customer[Continent],
Customer[CountryRegion],
"Count", COUNTROWS(CURRENTGROUP())
) ORDER BY Customer[Continent] DESC, Customer[CountryRegion] DESC
In this query:
This should give you the desired result, showing the count of items per each parent group, and only highlighting those groups where there is 1 item.
User | Count |
---|---|
13 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
13 | |
8 | |
8 |