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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
userpien
Helper IV
Helper IV

value of a card doesn't display in table

Hi, i have this measure that display a right value in a card.

Quantità No Promo Media (no giorni promo) =

VAR _1 =IF([Quant No Prom]>0, [Quant No Prom]/[Giorni No Prom])
VAR _2 = CALCULATE(COUNTX(VALUES(ANCL[PuntoID]),_1),FILTER(VALUES(ANCL[PuntoID]),[Quant]<>BLANK()))
VAR _3 = DIVIDE(_1,_2)
RETURN
IF([Solo Quant No Prom],_3 ,BLANK())


Card:

userpien_0-1725443680726.png

 

But if i try to insert this measure in a table, it doesn't show values


How i should edit the maesure to show values in table? thank you





1 ACCEPTED SOLUTION
moncx
Resolver II
Resolver II

Hey,
the answer depends on a data that you have and measures that you use in a variables, without seeing these things it is hard to answer what to change. 
Context of a card visual and table differs - in a card visual Power BI evaluates the measure in a single, overall context (e.g., all data for the selected filters), this typically means that the variables _1, _2, and _3 are calculated as aggregated values, leading to a single result that can be correctly divided and displayed; and in a table visual, the measure is calculated for each row in the table, with a different context for each row.

You probably get 0 for _2 variable if division returns infinity, so try checking all of the variable parts. I would create separate measure for _2 variable just to check what it returns, if it really returns 0 then break the measure into parts -> create measures to make sure which part of a measure returns wrong answer (COUNTX or FILTER -> maybe some of these in a table cannot be calculated by your row context because it does not have values).

View solution in original post

2 REPLIES 2
v-yaningy-msft
Community Support
Community Support

Hi, @userpien 

Thanks for moncx reply. Without data, it's hard to determine what's happening. You can provide a complete pbix file without sensitive data for testing and a screenshot of what you want to achieve. This will help you to solve the problem faster.

Best Regards,
Yang
Community Support Team

moncx
Resolver II
Resolver II

Hey,
the answer depends on a data that you have and measures that you use in a variables, without seeing these things it is hard to answer what to change. 
Context of a card visual and table differs - in a card visual Power BI evaluates the measure in a single, overall context (e.g., all data for the selected filters), this typically means that the variables _1, _2, and _3 are calculated as aggregated values, leading to a single result that can be correctly divided and displayed; and in a table visual, the measure is calculated for each row in the table, with a different context for each row.

You probably get 0 for _2 variable if division returns infinity, so try checking all of the variable parts. I would create separate measure for _2 variable just to check what it returns, if it really returns 0 then break the measure into parts -> create measures to make sure which part of a measure returns wrong answer (COUNTX or FILTER -> maybe some of these in a table cannot be calculated by your row context because it does not have values).

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors