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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

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, @Anonymous 

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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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