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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Vanessa250919
Helper IV
Helper IV

Group by with filter

Hello, I created a group by table in dax, it's possible to add a filter  ? I need for all average to filter 0 vallue  . 

 

Thanks 

 

 

pivot =
GROUPBY(
MASTERTABLE,MASTERTABLE[POSTAL_CODE],MASTERTABLE[DIENST], MASTERTABLE[Key],
"PAK_VOL_REEL",AVERAGEx(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_REEL]),
"PAK_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_ORG]),
"EE_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_ORG]),
"EE_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_REEL]),
"ENA_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_ORG]),
"ENA_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_REEL]),
"FNGF_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_ORG]),
"FNGF_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_REEL]),
"KRANT_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_ORG]),
"KRANT_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_REEL])
1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Vanessa250919 ,

 

sure, you can use the FILTER function to filter the group by table:

FILTER
    GROUPBY (
        MASTERTABLE,
        MASTERTABLE[POSTAL_CODE],MASTERTABLE[DIENST], MASTERTABLE[Key],
        "PAK_VOL_REEL",AVERAGEx(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_REEL]),
        "PAK_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_ORG]),
        "EE_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_ORG]),
        "EE_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_REEL]),
        "ENA_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_ORG]),
        "ENA_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_REEL]),
        "FNGF_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_ORG]),
        "FNGF_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_REEL]),
        "KRANT_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_ORG]),
        "KRANT_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_REEL])
    ),
    [ENA_VOL_REEL] > 0 && [KRANT_VOL_REEL] > 0
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

3 REPLIES 3
selimovd
Super User
Super User

Hey @Vanessa250919 ,

 

sure, you can use the FILTER function to filter the group by table:

FILTER
    GROUPBY (
        MASTERTABLE,
        MASTERTABLE[POSTAL_CODE],MASTERTABLE[DIENST], MASTERTABLE[Key],
        "PAK_VOL_REEL",AVERAGEx(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_REEL]),
        "PAK_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_ORG]),
        "EE_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_ORG]),
        "EE_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_REEL]),
        "ENA_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_ORG]),
        "ENA_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_REEL]),
        "FNGF_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_ORG]),
        "FNGF_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_REEL]),
        "KRANT_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_ORG]),
        "KRANT_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_REEL])
    ),
    [ENA_VOL_REEL] > 0 && [KRANT_VOL_REEL] > 0
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hello @selimovd , I tryed to make a filter like this :

pivot = FILTER(
GROUPBY (
MASTERTABLE,
MASTERTABLE[POSTAL_CODE],MASTERTABLE[DIENST], MASTERTABLE[Key],
"PAK_VOL_REEL",AVERAGEx(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_REEL]),
"PAK_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[PAK_VOLUME_ORG]),
"EE_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_ORG]),
"EE_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[EE_INDIV_REEL]),
"ENA_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_ORG]),
"ENA_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[ENA_VOLUME_REEL]),
"FNGF_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_ORG]),
"FNGF_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[FNGF_VOLUME_REEL]),
"KRANT_VOL_ORG",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_ORG]),
"KRANT_VOL_REEL",AVERAGEX(CURRENTGROUP(),MASTERTABLE[KRANT_VOLUME_REEL])
) ,[PAK_VOL_ORG] >0 || [KRANT_VOL_ORG] >0 || [EE_VOL_ORG] >0 || [ENA_VOL_ORG] >0 || [FNGF_VOL_ORG]>0 )

 

But I have always a 0 values 

 

Vanessa250919_0-1625647474111.png

 

Hey @Vanessa250919 ,

 

in your measure you didn't filter for [PAK_VOL_REEL] > 0, so it will also show the 0 values for that Group by column.

I can't tell you why the values are 0 as you didn't share any data with us.

 

Does that make sense?

 

Best regards

Denis

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.