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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AleMacedo
Helper I
Helper I

Allexecpt with multiple filters

Hi all,

I have a single table of monthly  produtivity employees reports.

I have a measure for media for each task category and need to calculate media for all company in each category with filters options to year, task category, Unit Group and employee group. 

My fact table ("Rels") has : Initial Date , Final Date (in a single month per line) ,  Unit Id, AuthorId, Task Category, Value (number of tasks done), and employee group.

 

I have others table to calendar, Units Name with column to unit group,  Tasks, Employee Group and Employees with Id

 

I have a measure to media = average (Rels[Valoue])

My Media - all Company = AVERAGEX (ALLEXCEPT(RelsRels[Category],Calendar[Date],Rels[EmployeeGroup],Units[UnitGroup]),Mesuare[Media])

 

This Media - all company is not working.

What I need to change?

 

My schema:

AleMacedo_0-1653002882965.png

 

AleMacedo_1-1653002993378.png

 

1 ACCEPTED SOLUTION

Hi @AleMacedo 

Try code like below,

Media MPSP =
calculate(
[Media],
Filter(ALLEXCEPT(Rels,Atributos[Atributo],Relatorios[Relatorio],Calendario[Date].[Date],UnidadeAdministrativa[Entrancia]),Rels[date]= min(Calendario[Date])  ))
Generally speaking, it filters the table Rels based on the date in the current row.
 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

=
CALCULATE (
    [Media],
    ALLEXCEPT (
        Rels,
        Rels[Category],
        Calendar[Date],
        Rels[EmployeeGroup],
        Units[UnitGroup]
    )
)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

I did it:

Media MPSP =
calculate(
[Media],
ALLEXCEPT(Rels,Atributos[Atributo],Relatorios[Relatorio],Calendario[Date].[Date],UnidadeAdministrativa[Entrancia]))
 
but its not considering filter for date. All the other filters are ok.

Hi @AleMacedo 

Try code like below,

Media MPSP =
calculate(
[Media],
Filter(ALLEXCEPT(Rels,Atributos[Atributo],Relatorios[Relatorio],Calendario[Date].[Date],UnidadeAdministrativa[Entrancia]),Rels[date]= min(Calendario[Date])  ))
Generally speaking, it filters the table Rels based on the date in the current row.
 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Thank you!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors