Forum Discussion

lastnn30's avatar
lastnn30
Post Patron
4 years ago
Solved

Modeling is not working

Hi

I have 2 tables (FactTable and dTable1, please see below)  in an excel file. I do not want to use Power Query-->merge, to get Region from the dTable1. So created 1-to-Many relationship (PBI did it for me). I used PowerQuery to add Revenue column in FactTable ((1-discount)*unit*price).  Now when I try to insert a visual and insert  Region and Revenue, PBI did not group Regions and I can not change the function for Revenue to do SUM. What is the issue please? I PBI file is here if you are interested

 

https://drive.google.com/file/d/1HuPC_X-l5ihXFB_AkQ26DBprFCJ248IY/view?usp=sharing

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi lastnn30 , 

    Please refer to my pbic file to see if it helps you.

    Create a column firstly.

    Column = CALCULATE(MAX(DTable1[Region]),FILTER((DTable1),DTable1[SalesRep]=EARLIER(FactTable[SalesRep])))

    Then create a measure.

    Measure 3 = CALCULATE(SUM(FactTable[Revenue]),FILTER(ALL(FactTable),FactTable[Column]=SELECTEDVALUE(FactTable[Column])))

    If I have misunderstood your meaning, please provide your desired output with more details.

     

    Best Regards

    Community Support Team _ Polly

     

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

5 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    The issue is that your Revenue is set to text data type. In the query editor, change it to a numeric data type and the option to summarize it with a sum will appear. However, I encourage you to create a simple measure with the SUM function instead.

     

    Pat

    • lastnn30's avatar
      lastnn30
      Post Patron

      Thank you for your reply. Could you please explain how to create a measure with the SUM? Thanks again.

  • Thank you very much. When I opned Power Query editor, I saw the column was formatted to 1.2 (decimal)! but despite that I clicked on the drop down menu and clicked decimal again and it is working. Thank you very much again. I wont be able to figure that out without your help.

  • ERD's avatar
    ERD
    Community Champion

    lastnn30 , you need to change the format of the column to Decimal:

    and then to summarize the column if you want to use it this way:

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

    I am a Ukrainian living in Ukraine. Please, help us to survive. Here are official ways you can support us (accounts with multiple currencies):
    https://bank.gov.ua/ua/about/support-the-armed-forces

    USD:
    BENEFICIARY: National Bank of Ukraine
    BENEFICIARY BIC: NBUA UA UX
    BENEFICIARY ADDRESS: 9 Instytutska St, Kyiv, 01601, Ukraine
    ACCOUNT NUMBER: 400807238
    BENEFICIARY BANK NAME: JP MORGAN CHASE BANK, New York
    BENEFICIARY BANK BIC: CHASUS33
    ABA 0210 0002 1
    BENEFICIARY BANK ADDRESS: 383 Madison Avenue, New York, NY 10017, USA
    PURPOSE OF PAYMENT: for crediting account 47330992708

    Accounts details for other currencies (EUR|GBP|CHF|AUD|CAD|PLN) can be found here: https://bank.gov.ua/ua/about/support-the-armed-forces

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi lastnn30 , 

    Please refer to my pbic file to see if it helps you.

    Create a column firstly.

    Column = CALCULATE(MAX(DTable1[Region]),FILTER((DTable1),DTable1[SalesRep]=EARLIER(FactTable[SalesRep])))

    Then create a measure.

    Measure 3 = CALCULATE(SUM(FactTable[Revenue]),FILTER(ALL(FactTable),FactTable[Column]=SELECTEDVALUE(FactTable[Column])))

    If I have misunderstood your meaning, please provide your desired output with more details.

     

    Best Regards

    Community Support Team _ Polly

     

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