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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ImSctm
Frequent Visitor

How to use a "measured column" to filter a virtual table

Hello,


Does someone know how to filter a table from a created column that comes from a new variable? I'll show the measure:

--------------------------------------------------------------------------------------

VAR Dif_Hours =
Hores_Mes_Actual - Hores_Mes_Anterior
//I have a number diference = [hours this month - hours previous month] as a starting point //


VAR Numero_Feines_Incrementen =
    COUNTAX(
        CALCULATETABLE(
            ADDCOLUMNS(
                SUMMARIZE('Productivitat DIA','Productivitat DIA'[NAME]
                ),
                "Dif_Hours123",Dif_Hours
            ),
        Dif_Hours123>0),
    'Productivitat DIA'[NAME]
    )
//What I want is to use the variable Dif_Hours as a filter to COUNTAX and only count rows number of Productivitat DIA'[NAME] that have Dif_Hours > 0.  //


Of course, DAX doesn't accept the new column "Dif_Hours123" as a table name or a correct function. But I can't find a suitable alternative.

Much appreciated if you can help...


Update: 
I've got something closer by applying countax after virtual table. Still result not satisfactory as it shows total of rows without filter:
Total is 11 and by filtering it should be 5.

----------------------------------------------------------
VAR
Diferencia_Hores =
Hores_Mes_Actual - Hores_Mes_Anterior

VAR Taula_Dif_Hores =
    CALCULATETABLE(
        ADDCOLUMNS(
            SUMMARIZE('Productivitat DIA','Productivitat DIA'[NAME]
            ),
            "Dif_Hores",Diferencia_Hores
        )
    )

RETURN
COUNTAX(
    FILTER(Taula_Dif_Hores,[Dif_Hores]>0),[Dif_Hores])


1.JPG

 

0 REPLIES 0

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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