Forum Discussion

Fcoatis's avatar
Fcoatis
Icon for Post Patron rankPost Patron
7 years ago
Solved

Calculate by Age Range

Hi,

 

In a sample data model as follows:

 

 

My fact table Venda (Sales) has 3 calculated columns :

 

Idade (Age)

 

 

Etaria (Age Range):

 

 

and Pos ( just for sort purposes). Im trying to calculate a matrix like this one:

 

 

But the measure (.Total Range) is not ignoring the Age Range filter. What am I doing wrong? All Ranges for each year , should be the Total for that year.

 

 

Thanks in advance.

 

Fabio Coatis

 

 

 

  • hi, Fcoatis

    After my test, this is due to Sort by Function, so you could use this formula:

    .Total Range = CALCULATE([.Total],all(Venda[Etaria],Venda[Pos]))

    Result:

     

    Best Regards,

    Lin

     

     

4 Replies

  • v-lili6-msft's avatar
    v-lili6-msft
    Icon for Community Support rankCommunity Support

    HI, Fcoatis

    I have tested on my side, but not reproduce the issue. If possible, please share detail steps for us.

    please share your sample pbix file and expected output. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.

     

     

    Best Regards,

    Lin

    • Fcoatis's avatar
      Fcoatis
      Icon for Post Patron rankPost Patron

      Thank you for your reply.

       

      Here is the link:

       

      https://drive.google.com/drive/folders/1R45lnyJbHMW8SNPtzrVuSRBjfCPiPowX?usp=sharing

       

      The result esxpected is :

       

      Column12000Column22001Column3

      Etaria.Total.Total Range.Total.Total Range
      0-2076.831345.44772.938344.210
      21-3044.930345.44751.143344.210
      31-4069.492345.44752.292344.210
      41-5030.166345.44756.998344.210
      51-6051.055345.44744.336344.210
      61-7072.973345.44766.503344.210
      71-80 345.447 344.210
      >80 345.447 344.210
      Total345.447 344.210 

       

      Thanks in advance

      • v-lili6-msft's avatar
        v-lili6-msft
        Icon for Community Support rankCommunity Support

        hi, Fcoatis

        After my test, this is due to Sort by Function, so you could use this formula:

        .Total Range = CALCULATE([.Total],all(Venda[Etaria],Venda[Pos]))

        Result:

         

        Best Regards,

        Lin