Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Measure rounded to 0 decimals in DirectQuery

Hello,

I have a hybrid dataset connected to Snowflake via DirectQuery for Fact tables and import for dimension tables.

I've created a measure with SUM, but when i visualize it the decimals are rounding to 0, but the field from table is OK, it shows correctly decimals:

I need the decimal part on measure. Anyone have idea for right it?

 

Thanks in advance.

 

Regards,

4 Replies

  • Hello Anonymous ,

     

    You can create a new measure, like this= ROUND(SUM('FactTable'[Amount]), 2)

     

    Or  you can multiply with "1.0"

     

     

    If this solved your issue, please mark it as the accepted solution. โœ…

  • Hi Anonymous ,
    Please use the below measure to achieve the desirable output. 

    15.2 Valor Mercado Contravalorado =
    ROUND(SUM(FACT_SCR_TIPO_CAMBIO[VALOR_MERCADO_KONTRAV]), 2)

    If the issue is still unresolved, check the column-level formatting for VALOR_MERCADO_KONTRAV in your data model:

    • Is it defined as Fixed Decimal Number or Whole Number in Snowflake?

    • Sometimes, DirectQuery doesn't recognize precision unless explicitly defined in the source.

    ๐ŸŒŸ I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.

    ๐Ÿ’ก Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.

    ๐ŸŽ– As a proud SuperUser and Microsoft Partner, weโ€™re here to empower your data journey and the Power BI Community at large.

    ๐Ÿ”— Curious to explore more? [Discover here].

    Letโ€™s keep building smarter solutions together!

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for your answers anilelmastasi  and grazitti_sapna .

    I try the round function on measure and multiply by 1.0, but the result is the same:

    โ€ƒIn Snowflake the field was defined as NUMBER(18,2), in PowerBI this column is difined as "Decimal", but in DirectQuery we can't change the type to "force it"

     

    I analyse the query that PowerBI made for extract data from Snowflake, PowerBi send this query to Snowflake:

     

    select SUM(cast("VALOR_MERCADO_KONTRAV" as INTEGER)) as "C1"
    from
    (
    select "VALOR_MERCADO_KONTRAV"
    from "FACT_SCR_TIPO_CAMBIO"
    where cast("ID_FECHA" as DECIMAL) = CAST(20250131 as DECIMAL)
    ) as "ITBL"

     

    It converts the value to integer, but i don't know why it is doing this transformation. There are anyway to change it the way PowerBI mades this query?