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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
TJCappy
Frequent Visitor

Filtering data captured from a toggle button.

I have a list of items called "Items" with the following columns:

ID,

Department,

Product number,

Product Name,

Purchase Price,

Markup %

Sale Price

New Item - This is a toggle button, that displays yes or no on the canvas app form but records the response in the list as true or false.

 

I have the following formula to give me a total number of items in the list:

    --     Item Total =

                    COUNT('Items'[ID])

 

I then have a formula gives me the number of items per department:

    --     Item total for Dept U16 =

                     CALCULATE(

                                [Item Total],

                                Filter('Items', Items[Department] = "U16"

)

 

now I want to filter the number of items for Dept U16  to show how many are new.

 

I have tried 

        --Total New Items for Department U16 =

           CALCULATE(

                      [Item total for Dept U16 ],

                      FILTER( 'Items', 'Items'[Department] = "U16" && 'Items'[New Item] = "yes" )

)

 

but I get a "Blank" response

but I know I have 420 new Items for Dept U16

 

I tried changing the "yes" in the formula  to true  but then get this message

 

"Calculation error in 'Measures table 01'[Total New Items for Department U16]:

Dax comparison operations do not support comparing values of the type Text with values of type True/False.

Consider using the VALUE or FORMAT function to convert one of the values."

 

 

Can anyone please assist me in resolving this conundrum.

 

Thank you

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@TJCappy , First of all check that 'Items'[New Item]  is a column. Also, check what are distinct values. You can put in table visual and check

yes <> Yes in text comparison

 

if it is a measure share calculation

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Hi Amit,

 

Thanks for your comments

 

As you can see below 'Items'[NewItem]   is a column.

 

I am unsure what you mean when you say

"Also, check what are distinct values. You can put in table visual and check yes <> Yes in text comparison"

 

The calculations are

Measure 1

Item Total =

                    COUNT('Items'[ID])

 

Measure 2

Item total for Dept U16 =

                     CALCULATE(

                                [Item Total],

                                Filter('Items', Items[Department] = "U16"

)

 

Measure 3

Total New Items for Department U16 =

           CALCULATE(

                      [Item total for Dept U16 ],

                      FILTER( 'Items', 'Items'[Department] = "U16" && 'Items'[New Item] = "yes" )

)

 


The following table is the sample data taken directly from the table,  (I ommitted the product name for the sake of privacy)

 

IDDepartmentProductNumberProduct NamePurchasePriceMarkup%SalePriceNewItem
1U710DAM-0Z-JWJ0-0Z-2 Purposely omitted$3,005.00133%$7,000.00FALSE
2U001DB2-0Z-YJD0-0Z-1 Purposely omitted$3,300.0052%$5,000.00FALSE
3U001DB1-0Z-APM0-0Z-1 Purposely omitted$1,000.0050%$1,500.00FALSE
4U001DB3-0Z-9CN0-0Z-1Purposely omitted$700.0043%$1,000.00FALSE
5U710DB2-0Z-JAR0-0Z-1Purposely omitted$450.00122%$1,000.00TRUE
6U710DB2-0Z-4LV0-0Z-3Purposely omitted$300.00233%$1,000.00FALSE
7U710DAM-0Z-6T31-0Z-7Purposely omitted$900.00250%$3,150.00FALSE
8U16DB2-0Z-XXH0-0Z-1Purposely omitted$7,000.00257%$25,000.00FALSE
9U710DB3-0Z-93U0-0Z-3Purposely omitted$1,008.0098%$2,000.00TRUE
10U16DAK-0Z-M6J0-0Z-2 Purposely omitted$10,500.0090%$20,000.00TRUE
11U16DAJ-0Z-QQ60-0Z-2Purposely omitted$500.003900%$20,000.00TRUE
12U710DB3-0Z-ARR0-0Z-2  Purposely omitted$300.001567%$5,000.00FALSE
13U710DA8-0Z-DMK0-0Z-2  Purposely omitted$300.00567%$2,000.00FALSE
14U710DA8-0Z-DMH0-0Z-2Purposely omitted$300.001567%$5,000.00FALSE
15U710DAL-0Z-Z3B0-0Z-3 Purposely omitted$300.00233%$1,000.00FALSE
16U710DAL-0Z-2VB0-0Z-2Purposely omitted$300.00567%$2,000.00TRUE

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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