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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Actual Table V Virtual Table

Hi Experts

Slightly lost on this one, i cannot see where my error is in my DAX formula.

Here is the scenario.

i have the following table as a physical Table which i have entered into PBIX file.

Which using the following DAX give the correct results all the time.

__freq = 
VAR __table = SUMMARIZE(MK,[Value],"__ties",COUNT(MK[ID])-1)
VAR __table1 = ADDCOLUMNS(__table,"__freq",IF([__ties]=0,0,[__ties]*([__ties]+1)*(2*[__ties]+7)))
RETURN      
SUMX(__table1,[__freq])


Test.png

 

 

 

 

 

 

 

 

 

 

 

 

However, when i try using a virtual table using the following DAX, i do not get the correct result all the time.

The difference here is we are using Date as a Index column where as above we have an index column not sure if this statement makes any difference at all.

__freq = 
VAR ComplaintsByFiscalMo = ADDCOLUMNS(VALUES(PMS_COMPLAINT[FISCAL_MON_START_DT]),"CountComplaints", CALCULATE(COUNTROWS(PMS_COMPLAINT)))
VAR __table = GROUPBY(ComplaintsByFiscalMo,[CountComplaints],"__ties",COUNTX(CURRENTGROUP(),[FISCAL_MON_START_DT]))
VAR __table1 = ADDCOLUMNS(__table,"__ties1",[__ties] - 1)
VAR __table2 = ADDCOLUMNS(__table1,"__freq",IF([__ties1]=0,0,[__ties1]*([__ties1]+1)*(2*[__ties1]+7)))
RETURN
SUMX(__table2,[__freq])
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Anonymous ,

I'd like to suggest you to split your formulas and expand it to multiple formulas, then you can trace each step formulas to confirm which one get the wrong result.
In addition, you can also take a look at following blog about power bi time intelligence date dimension:

Power BI Date Dimension; Default or Custom? Is It Confusing?

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @Anonymous ,

I'd like to suggest you to split your formulas and expand it to multiple formulas, then you can trace each step formulas to confirm which one get the wrong result.
In addition, you can also take a look at following blog about power bi time intelligence date dimension:

Power BI Date Dimension; Default or Custom? Is It Confusing?

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Xiaoxin Sheng firstly thanks for he feedback, excellent advise as always. thats what i did last night and found teh error.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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