Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Format numbers in MATRIX

I'm loading data from a datasource and using MATRIX  for output.  I need some values to be displayed in decimal numbers and some values to be displayed as %'s. Is this possible?

  • Hi Anonymous ,

     

    Please refer to my .pbix file.

     

     

    1. “I need only totals as totals of Actuals”

    For this requirement, you can create a measure like this.

    Measure = 
    VAR x = 
    SWITCH(
        SELECTEDVALUE(Sales[CountryRegion]),
        "dd", FORMAT( SUM(Sales[Sale 2014]), "Percent" ),
        FORMAT( SUM(Sales[Sale 2014]), "#, 0.00")
    )
    VAR y = 
    CALCULATE(
        SUM(Sales[Sale 2014]),
        FILTER( ALL(Sales), Sales[CountryRegion] = MAX(Sales[CountryRegion]) && Sales[Month] = "December")
    )
    RETURN
    IF(
        HASONEFILTER(Sales[Month]),
        x,y
    )

    2. Show the border of "Variance"

    This requirement is currently not possible, but you can mark ‘Variance’ in other ways.

    Firsr, create a measure like this.

    Conditional format = 
    IF(
        MAX(Sales[Month]) = "January",
        "Green"
    ) 

     Second, add the measure to the 'conditional formatting' label.

     

    Best regards,
    Lionel Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

14 Replies

  • Anonymous 

    It depends if you need to have two different formats for the same measure, you can try like the example below.

     
     

     

    Total Orders = 
    VAR C = COUNTROWS(Orders) 
    RETURN
    
    IF(
        C < 5 ,
        FORMAT(COUNTROWS(Orders)/100,"0.0%"),
        C
    )

     

     

     

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon on the right if you like this reply 🙂

    YouTube, LinkedIn

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Fowmy ,

       

      Thanks for your response.

       

      My dataset is as shown below:

      Allocations

      m$
      Actual0.08
      Strategic0.03
      Variance0.12
      Funds3456.08
        

       

      My output is a MATRIX and needs to be displayed as follows:

       

      ActualStrategicVarianceFunds
      8%3%12%3456.08
      • Fowmy's avatar
        Fowmy
        Super User

        Anonymous 


        You can modify the SWITCH statement to suit for your options.



        ________________________

        Did I answer your question? Mark this post as a solution, this will help others!.

        Click on the Thumbs-Up icon on the right if you like this reply 🙂

        YouTube, LinkedIn