cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GreenPowerRangr
Frequent Visitor

The True/False expression does not specify a column. Each True/False expressions used as a table fil

Hi everyone,

 

I am looking for a solution to the error I'm facing below. I have tried created a New Measure with the following Formula. Can someone point me where I'm making a mistake please? I have tried using Median inside the variable below but unfortunately not able to, is this what is causing this error? My aim is to have one Calculated column with the Trading Gap instead of having  8 columns. Any help/guidance is appreciated. 

 

1 Trading Gap $ =


VAR CurrentSales = sum('Store data'[Sales MAT])

VAR VarietalProducts = calculate(counta('Store data'[PRODUCT_NAME]), ALLEXCEPT('Store data','Store data'[STORE_CODE], 'Store data'[Varietal]), CurrentSales > 0)

VAR VarietalProductsSales = CALCULATE(sum('Store data'[Sales MAT]), ALLEXCEPT('Store data','Store data'[STORE_CODE], 'Store data'[Varietal]))

VAR PartofVarietalProducts = divide(1,VarietalProducts)

VAR PartofVarietalProductsSales = divide(CurrentSales,VarietalProductsSales)

VAR LocalIndex = DIVIDE(PartofVarietalProductsSales,PartofVarietalProducts,0)

VAR MedianIndex = CALCULATE(MEDIAN('Store data'[Local Index]), ALLEXCEPT('Store data','Store data'[PRODUCT_NAME]), CurrentSales > 0 )

VAR PotentialSales = MedianIndex * PartofVarietalProducts * VarietalProductsSales

RETURN
            CALCULATE ((PotentialSales-CurrentSales), CurrentSales > 0 )

 

Capturse.PNG

 

 

 

 

 

Thanks

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @GreenPowerRangr 

 

Please try this measure instead.

Trading Gap $ =

VAR CurrentSales =

    SUM ( 'Store data'[Sales MAT] )

VAR VarietalProducts =

    CALCULATE (

        COUNTA ( 'Store data'[PRODUCT_NAME] ),

        FILTER (

            ALLEXCEPT ( 'Store data', 'Store data'[STORE_CODE], 'Store data'[Varietal] ),

            CurrentSales > 0

        )

    )

VAR VarietalProductsSales =

    CALCULATE (

        SUM ( 'Store data'[Sales MAT] ),

        ALLEXCEPT ( 'Store data', 'Store data'[STORE_CODE], 'Store data'[Varietal] )

    )

VAR PartofVarietalProducts =

    DIVIDE ( 1, VarietalProducts )

VAR PartofVarietalProductsSales =

    DIVIDE ( CurrentSales, VarietalProductsSales )

VAR LocalIndex =

    DIVIDE ( PartofVarietalProductsSales, PartofVarietalProducts, 0 )

VAR MedianIndex =

    CALCULATE (

        MEDIAN ( 'Store data'[Local Index] ),

        FILTER (

            ALLEXCEPT ( 'Store data', 'Store data'[PRODUCT_NAME] ),

            CurrentSales > 0

        )

    )

VAR PotentialSales = MedianIndex * PartofVarietalProducts * VarietalProductsSales

return

    CALCULATE (

        ( PotentialSales - CurrentSales ),

        FILTER ( 'Store data', CurrentSales > 0 )

    )

 

Then use this measure to create a new measure, use this new measure to create visual.

Sum_Trading Gap$ = SUMX('Store data','Store data'[Trading Gap $])

 

Result looks like this:

vcazhengmsft_0-1636535334133.png

Attached the pbix file as reference.

 

Best Regards,

Community Support Team _ Caiyun

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it, please feel free to let us know. Thanks a lot!

 

View solution in original post

3 REPLIES 3
v-cazheng-msft
Community Support
Community Support

Hi @GreenPowerRangr 

 

Please try this measure instead.

Trading Gap $ =

VAR CurrentSales =

    SUM ( 'Store data'[Sales MAT] )

VAR VarietalProducts =

    CALCULATE (

        COUNTA ( 'Store data'[PRODUCT_NAME] ),

        FILTER (

            ALLEXCEPT ( 'Store data', 'Store data'[STORE_CODE], 'Store data'[Varietal] ),

            CurrentSales > 0

        )

    )

VAR VarietalProductsSales =

    CALCULATE (

        SUM ( 'Store data'[Sales MAT] ),

        ALLEXCEPT ( 'Store data', 'Store data'[STORE_CODE], 'Store data'[Varietal] )

    )

VAR PartofVarietalProducts =

    DIVIDE ( 1, VarietalProducts )

VAR PartofVarietalProductsSales =

    DIVIDE ( CurrentSales, VarietalProductsSales )

VAR LocalIndex =

    DIVIDE ( PartofVarietalProductsSales, PartofVarietalProducts, 0 )

VAR MedianIndex =

    CALCULATE (

        MEDIAN ( 'Store data'[Local Index] ),

        FILTER (

            ALLEXCEPT ( 'Store data', 'Store data'[PRODUCT_NAME] ),

            CurrentSales > 0

        )

    )

VAR PotentialSales = MedianIndex * PartofVarietalProducts * VarietalProductsSales

return

    CALCULATE (

        ( PotentialSales - CurrentSales ),

        FILTER ( 'Store data', CurrentSales > 0 )

    )

 

Then use this measure to create a new measure, use this new measure to create visual.

Sum_Trading Gap$ = SUMX('Store data','Store data'[Trading Gap $])

 

Result looks like this:

vcazhengmsft_0-1636535334133.png

Attached the pbix file as reference.

 

Best Regards,

Community Support Team _ Caiyun

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it, please feel free to let us know. Thanks a lot!

 

amitchandak
Super User
Super User

@GreenPowerRangr , You need to use some level in measure filter and prefer filter clause .

 

Try like

 

Trading Gap $ =
VAR CurrentSales = sum('Store data'[Sales MAT])
VAR VarietalProducts = calculate(counta('Store data'[PRODUCT_NAME]), ALLEXCEPT('Store data','Store data'[STORE_CODE], 'Store data'[Varietal]), CurrentSales > 0)
VAR VarietalProductsSales = CALCULATE(sum('Store data'[Sales MAT]), ALLEXCEPT('Store data','Store data'[STORE_CODE], 'Store data'[Varietal]))
VAR PartofVarietalProducts = divide(1,VarietalProducts)
VAR PartofVarietalProductsSales = divide(CurrentSales,VarietalProductsSales)
VAR LocalIndex = DIVIDE(PartofVarietalProductsSales,PartofVarietalProducts,0)
VAR MedianIndex = CALCULATE(MEDIAN('Store data'[Local Index]), ALLEXCEPT('Store data','Store data'[PRODUCT_NAME]),filter(values('Store data'[PRODUCT_NAME]), CurrentSales > 0 ))
VAR PotentialSales = MedianIndex * PartofVarietalProducts * VarietalProductsSales

RETURN
            CALCULATE ((PotentialSales-CurrentSales), filter(values('Store data'[PRODUCT_NAME]), CurrentSales > 0 ))


New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

Hi Amit,

 

Thanks for your suggestion. However, I'm still getting the  same error. 

The calculations are done on one table only. 
I'm struggling to understand what's causing this error.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors